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.

Built Distribution

adsocket_transport-0.2.0-py3-none-any.whl (7.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page