Skip to main content

Websocket protocol

Project description

ADSocket

WebSocket server based on aiohttp.

Install

Using python package

pip install adsocket

How it works

To start the very basic server, this command will do:

adsocket

assuming that you have redis server started on localhost listening on port 6379.

Now you should be able to connect to server on ws://localhost:5000

Basic usage

Adsocket should work out of the box, however it's probably not what you would expect. To customize adsocket you can create custom channels, authentication or commands.

Example of setting file

from adsocket.conf.default_settings import *  # NOQA

CHANNELS = {
    'global': {
        'driver': 'my_package.channels.GlobalChannel',
        'create_on_startup': True,
    },
    'user': {
        'driver': 'my_package.channels.MyUserChannel',
        'create_on_startup': False,
    }
}

AUTHENTICATION_CLASSES = (
    'sraps_socket.auth.SrapsAuth',
)

DISCONNECT_UNAUTHENTICATED = False

To apply changes to adsocket you need to export environment variable with path to settings

export ADSOCKET_SETTINGS=my_package.settings

Sending messages from you application

See adsocket-transport.

Documentation

@Todo

Goals

Out motivation to behind is follows:

  • High scalability
  • High performance
  • Easy customization
  • Easy extendability

Channels

All communication between server and client is through channels. Any client (understand websocket connection) can be member of n channels. There is no automatic subscription to channel so in order ot receive messages from server client have to subscribe to channels he or she wants to receive messages from or publish messages to.

Custom channels

@Todo

Commands

@Todo

Custom command

@Todo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for adsocket, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size adsocket-0.1.1-py3-none-any.whl (22.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size adsocket-0.1.1.tar.gz (16.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page