aiosm-0.0.6
توضیحات
An asynchronous network hub
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | aiosm-0.0.6 |
| نام | aiosm |
| نسخه کتابخانه | 0.0.6 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Callum B-C <callum@fish.cat> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/aiosm/ |
| مجوز | - |
# 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")
نیازمندی
| مقدار | نام |
|---|---|
| - | sphinx |
| - | pytest |
| - | pytest-cov |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl aiosm-0.0.6:
pip install aiosm-0.0.6.whl
نصب پکیج tar.gz aiosm-0.0.6:
pip install aiosm-0.0.6.tar.gz