Skip to main content

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

Release files for adsocket 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for adsocket 0.2.2
File Interpreter ABI Platform
adsocket-0.2.2-py3-none-any.whl Python 3 none any Details

Release files / adsocket-0.2.2-py3-none-any.whl

Download URL adsocket-0.2.2-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0579080962ab9cdec7a6027ac90470b17d97ad046b8b1235c7f2b9737778b40
BLAKE2b-256 checksum
How to use checksums
35dfc0fb7f8fdc09f1953d4dd5fd2c7237562789f6368ebaf86f3fd8a38de0b6
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.2.2 This release

1 release file

0.2.0

1 release file

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page