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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

adsocket-0.2.2-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file adsocket-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: adsocket-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13

File hashes

Hashes for adsocket-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0579080962ab9cdec7a6027ac90470b17d97ad046b8b1235c7f2b9737778b40
MD5 2a213952e8f599ff8d187dfb79180e6a
BLAKE2b-256 35dfc0fb7f8fdc09f1953d4dd5fd2c7237562789f6368ebaf86f3fd8a38de0b6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page