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
Close
Hashes for adsocket_transport-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d64d8f6a2afd910f07c1cdd4caa56d9309c27a549be3cac4a66f5e7d96819b0 |
|
MD5 | d5b7063738d3354ec2568aaa2f21ec92 |
|
BLAKE2b-256 | 0d30acdecc1142d6e871d8c22e7071869cdb50ac597dd4e5511adcce3f7075a6 |