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 Distribution
Built Distribution
Close
Hashes for adsocket_transport-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 063f21bf1e2c600d9dc73ac768d6d1f8dd631bf36e5a0603d284b4bdd97c02fa |
|
MD5 | b5b9f188e37a2b0dab59ee4796457b69 |
|
BLAKE2b-256 | bbc40e717e19b94f98c7d99d8a79dcd332ba6674af39e489ee6ee9484d975697 |