Skip to main content

ADSocket transport library

Project description

Adsocket transport

Install

pip install adsocket-transport

Usage

Transport initialization and sending message is very simple

from adsocket_transport import ADSocketTransport

adsocket = ADSocketTransport(
        driver='redis',
        host='redis://localhost:6379',
        db=1
    )

adsocket.send_data(data={'obj': 'user', 'obj_id': 4}, channels={'name': 'global', 'id': 'global'})

in case of async transport

from adsocket_transport import ADSocketAsyncTransport

adsocket = ADSocketAsyncTransport(
        driver='redis',
        host='redis://localhost:6379',
        db=1
    )
await adsocket.send_data(data={'obj': 'user', 'obj_id': 4}, channels={'name': 'global', 'id': 'global'})

Alternatively you can create message manually

from adsocket_transport import Message, ADSocketAsyncTransport

adsocket = ADSocketAsyncTransport(
        driver='redis',
        host='redis://localhost:6379',
        db=1
    )

message = Message(type='publish', data={'obj': 'user', 'obj_id': 4}, channel='global', channel_id='global')
await adsocket.send(message)

For more see adsocket-transport.

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_transport-0.2.0-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

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