Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

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.

Files for adsocket-transport, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size adsocket_transport-0.1.2-py3-none-any.whl (7.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size adsocket-transport-0.1.2.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View

Supported by

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