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.7+
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.1.1.tar.gz
(19.6 kB
view hashes)
Built Distribution
Close
Hashes for trio_engineio-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d0d0ffbe0e0aba3d97632ca7776629d6f29c83fccab86ec03c3437d28907c58 |
|
MD5 | 3df43f9d950df297e3089879a704d1b9 |
|
BLAKE2b-256 | 0a8c88b9bc66df5cd655f8de105957322d17266c2afc853a78b5dbbf640cb275 |