# Trio-Engine.IO
[![python](https://img.shields.io/badge/python-3.7%2B-blue)](https://github.com/Elmeric/trio-engineio)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Tests](https://github.com/Elmeric/trio-engineio/actions/workflows/Pipeline.yml/badge.svg)](https://github.com/Elmeric/trio-engineio/actions/workflows/Pipeline.yml)
[![Coverage Status](https://coveralls.io/repos/github/Elmeric/trio-engineio/badge.svg)](https://coveralls.io/github/Elmeric/trio-engineio)
[![license](https://img.shields.io/badge/license-BSD--3--Clause-green)](https://github.com/Elmeric/trio-engineio/blob/master/LICENSE)
An asynchronous **[Engine.IO](https://github.com/socketio/engine.io-protocol/tree/v3)** client using the [`trio`](https://trio.readthedocs/en/latest) framework.
Only the revision **3** of the Engine.IO protocol is supported.
## Requirements
- Python 3.9+
- [`trio`](https://trio.readthedocs.io/)
- [`httpcore`](https://www.encode.io/httpcore/)
- [`trio-websocket`](https://trio-websocket.readthedocs.io/)
## Usage
```Python
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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Elmeric/trio-engineio",
"name": "trio-engineio",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.9.0",
"maintainer_email": null,
"keywords": null,
"author": "Eric Lemoine",
"author_email": "erik.lemoine@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5d/f6/e3d2783ee18589250ca259cb4b7c1a3e1d6af635fe0b9eca23e19e163aaf/trio_engineio-0.2.0.tar.gz",
"platform": null,
"description": "\n# Trio-Engine.IO\n\n[![python](https://img.shields.io/badge/python-3.7%2B-blue)](https://github.com/Elmeric/trio-engineio)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Tests](https://github.com/Elmeric/trio-engineio/actions/workflows/Pipeline.yml/badge.svg)](https://github.com/Elmeric/trio-engineio/actions/workflows/Pipeline.yml)\n[![Coverage Status](https://coveralls.io/repos/github/Elmeric/trio-engineio/badge.svg)](https://coveralls.io/github/Elmeric/trio-engineio)\n[![license](https://img.shields.io/badge/license-BSD--3--Clause-green)](https://github.com/Elmeric/trio-engineio/blob/master/LICENSE)\n\nAn asynchronous **[Engine.IO](https://github.com/socketio/engine.io-protocol/tree/v3)** client using the [`trio`](https://trio.readthedocs/en/latest) framework.\n\nOnly the revision **3** of the Engine.IO protocol is supported.\n\n## Requirements\n\n- Python 3.9+\n- [`trio`](https://trio.readthedocs.io/)\n- [`httpcore`](https://www.encode.io/httpcore/)\n- [`trio-websocket`](https://trio-websocket.readthedocs.io/)\n\n## Usage\n\n```Python\nimport trio\n\nfrom trio_engineio.trio_client import EngineIoClient, EngineIoConnectionError\n\n\ndef on_connect():\n print(f\"***** Connected\")\n\n\ndef on_message(msg):\n print(f\"***** Received message: {msg}\")\n\n\ndef on_disconnect():\n print(f\"***** Disconnected\")\n\n \nasync def main():\n eio = EngineIoClient(logger=False)\n\n eio.on(\"connect\", on_connect)\n eio.on(\"message\", on_message)\n eio.on(\"disconnect\", on_disconnect)\n\n async with trio.open_nursery() as nursery:\n try:\n await eio.connect(nursery, \"http://127.0.0.1:1234\")\n except EngineIoConnectionError:\n return False\n return True\n\n\ntrio.run(main)\n```\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "An asynchronous Engine.IO client using the trio framework",
"version": "0.2.0",
"project_urls": {
"Documentation": "https://elmeric.github.io/trio-engineio",
"Homepage": "https://github.com/Elmeric/trio-engineio",
"Repository": "https://github.com/Elmeric/trio-engineio"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "398799982e9768d9c591bd17bc3648d3c7a1b8d4ca8724000e02e7f3e0bea487",
"md5": "faf2153733ab64e4fe0e595ec7acdd7e",
"sha256": "df002001d39b4b277f1bff690e53870fd82dec0296c83bbb96e3b56f9bbc8aa7"
},
"downloads": -1,
"filename": "trio_engineio-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "faf2153733ab64e4fe0e595ec7acdd7e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.9.0",
"size": 21495,
"upload_time": "2024-09-26T16:34:43",
"upload_time_iso_8601": "2024-09-26T16:34:43.221023Z",
"url": "https://files.pythonhosted.org/packages/39/87/99982e9768d9c591bd17bc3648d3c7a1b8d4ca8724000e02e7f3e0bea487/trio_engineio-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5df6e3d2783ee18589250ca259cb4b7c1a3e1d6af635fe0b9eca23e19e163aaf",
"md5": "26701707f180acd0efc84c6be9b47a64",
"sha256": "f80a9c6f948b973cf2567517a1437b55efaa8ce009774683c8340f2a4c2a9841"
},
"downloads": -1,
"filename": "trio_engineio-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "26701707f180acd0efc84c6be9b47a64",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.9.0",
"size": 19133,
"upload_time": "2024-09-26T16:34:44",
"upload_time_iso_8601": "2024-09-26T16:34:44.822036Z",
"url": "https://files.pythonhosted.org/packages/5d/f6/e3d2783ee18589250ca259cb4b7c1a3e1d6af635fe0b9eca23e19e163aaf/trio_engineio-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-26 16:34:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Elmeric",
"github_project": "trio-engineio",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "trio-engineio"
}