An asynchronous network hub
Project description
asyncio socket manager
Classes extending the Client class can overload the run function to connect, subscribe and run a loop in parallel
async def run(self):
await self.connect()
await self.request("subscribe", "clinet1")
await asyncio.gather(
super().run(),
self.loop()
)
A loop function can deal with outgoing communication as long as it periodically calls self.wait
async def loop(self):
asyncio.current_task().set_name(self.__name__ + "-Transmitter")
while True:
#
await self.wait()
To expose functions to RPC calling, add their name to the white_list_functions list. To call a function running on a serer node, use self.request():
await self.request("<name of function>", *args)
To call a function running on another client, use self.broadcast():
await self.request("<subscription tag>", "<name of function>", *args)
To subscribe to a new tag, call the subscribe function:
await self.request("subscribe", "clinet1")
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
aiosm-0.0.6.tar.gz
(5.4 kB
view details)
Built Distribution
aiosm-0.0.6-py3-none-any.whl
(6.6 kB
view details)
File details
Details for the file aiosm-0.0.6.tar.gz
.
File metadata
- Download URL: aiosm-0.0.6.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7c6789fea39e068584c2bcea39f44c03c8af1502c31398d4b11b51b84c4288e |
|
MD5 | c9bde2bc533e45cab6d36e90e24fa379 |
|
BLAKE2b-256 | f6a823e615e293957d7658b2b77ff2fe97f894e63d27348df3cf49e56098b9f4 |
File details
Details for the file aiosm-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: aiosm-0.0.6-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c9559a1ed50290b7ee0865d9df5a7827dc9775f87610d1a591077c7d5d0afbb |
|
MD5 | 376da31748b6b6cf853602d68c35e827 |
|
BLAKE2b-256 | d59ce1e6e3b03ae85fb9adca492d7847a7d52bd9db4a335415185e75c228b6c1 |