# 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/test.yml/badge.svg)](https://github.com/Elmeric/trio-engineio/actions/workflows/test.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.7+
- [`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": "",
"docs_url": null,
"requires_python": ">=3.7.2,<4.0.0",
"maintainer_email": "",
"keywords": "",
"author": "Eric Lemoine",
"author_email": "erik.lemoine@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ea/e4/ece8ebc59cb19307764c3c861b4e87195a134f5b564a6cb6e8495b095065/trio_engineio-0.1.1.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/test.yml/badge.svg)](https://github.com/Elmeric/trio-engineio/actions/workflows/test.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.7+\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.1.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "3df43f9d950df297e3089879a704d1b9",
"sha256": "3d0d0ffbe0e0aba3d97632ca7776629d6f29c83fccab86ec03c3437d28907c58"
},
"downloads": -1,
"filename": "trio_engineio-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3df43f9d950df297e3089879a704d1b9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.2,<4.0.0",
"size": 21532,
"upload_time": "2022-12-03T21:15:10",
"upload_time_iso_8601": "2022-12-03T21:15:10.354167Z",
"url": "https://files.pythonhosted.org/packages/0a/8c/88b9bc66df5cd655f8de105957322d17266c2afc853a78b5dbbf640cb275/trio_engineio-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "06bc336997f2ecdef85d52a4dc8ae72a",
"sha256": "0a4da142c398409e4210e0dc66d280a618d9cc777e0a0b60a0833615eea3f40e"
},
"downloads": -1,
"filename": "trio_engineio-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "06bc336997f2ecdef85d52a4dc8ae72a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.2,<4.0.0",
"size": 19617,
"upload_time": "2022-12-03T21:15:12",
"upload_time_iso_8601": "2022-12-03T21:15:12.260143Z",
"url": "https://files.pythonhosted.org/packages/ea/e4/ece8ebc59cb19307764c3c861b4e87195a134f5b564a6cb6e8495b095065/trio_engineio-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-03 21:15:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Elmeric",
"github_project": "trio-engineio",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "trio-engineio"
}