An asynchronous Engine.IO client using the trio framework
Project description
Trio-Engine.IO
An asynchronous Engine.IO client using the trio
framework.
Only the revision 3 of the Engine.IO protocol is supported.
Requirements
- Python 3.9+
trio
httpcore
trio-websocket
Usage
import trio
from trio_engineio.trio_client import EngineIoClient, EngineIoConnectionError
def on_connect():
print(f"***** Connected")
def on_message(msg):
print(f"***** Received message: {msg}")
def on_disconnect():
print(f"***** Disconnected")
async def main():
eio = EngineIoClient(logger=False)
eio.on("connect", on_connect)
eio.on("message", on_message)
eio.on("disconnect", on_disconnect)
async with trio.open_nursery() as nursery:
try:
await eio.connect(nursery, "http://127.0.0.1:1234")
except EngineIoConnectionError:
return False
return True
trio.run(main)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
trio_engineio-0.2.0.tar.gz
(19.1 kB
view hashes)
Built Distribution
Close
Hashes for trio_engineio-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df002001d39b4b277f1bff690e53870fd82dec0296c83bbb96e3b56f9bbc8aa7 |
|
MD5 | faf2153733ab64e4fe0e595ec7acdd7e |
|
BLAKE2b-256 | 398799982e9768d9c591bd17bc3648d3c7a1b8d4ca8724000e02e7f3e0bea487 |