{"id":18740571,"url":"https://github.com/aratz-lasa/async-multiplexer","last_synced_at":"2025-11-20T00:30:17.063Z","repository":{"id":52696249,"uuid":"260079505","full_name":"aratz-lasa/async-multiplexer","owner":"aratz-lasa","description":"Python Asyncio TCP multiplexer","archived":false,"fork":false,"pushed_at":"2021-04-20T19:50:15.000Z","size":40,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T00:20:06.734Z","etag":null,"topics":["asyncio","mplex","multiplexer","python","stream","tcp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aratz-lasa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-30T00:50:01.000Z","updated_at":"2021-03-22T08:23:01.000Z","dependencies_parsed_at":"2022-08-21T18:00:27.116Z","dependency_job_id":null,"html_url":"https://github.com/aratz-lasa/async-multiplexer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aratz-lasa%2Fasync-multiplexer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aratz-lasa%2Fasync-multiplexer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aratz-lasa%2Fasync-multiplexer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aratz-lasa%2Fasync-multiplexer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aratz-lasa","download_url":"https://codeload.github.com/aratz-lasa/async-multiplexer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239619573,"owners_count":19669447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","mplex","multiplexer","python","stream","tcp"],"created_at":"2024-11-07T15:39:42.981Z","updated_at":"2025-11-20T00:30:16.984Z","avatar_url":"https://github.com/aratz-lasa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async_multiplexer\n[![PyPI version](https://badge.fury.io/py/async-multiplexer.svg)](https://badge.fury.io/py/async-multiplexer)\n[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)\n[![Build Status](https://travis-ci.com/aratz-lasa/async-multiplexer.svg?branch=master)](https://travis-ci.com/aratz-lasa/async-multiplexer)\n[![codecov](https://codecov.io/gh/aratz-lasa/async-multiplexer/branch/master/graph/badge.svg)](https://codecov.io/gh/aratz-lasa/async-multiplexer)\n\n[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)\n[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n\n**async_multiplexer** is a TCP Multiplexer based on [Mplex](https://github.com/libp2p/specs/tree/master/mplex) protocol, but simplified.\nIt is intended for creating mutiple streams in parallel\non top of a same TCP connection.\n\n## Installation\n```bash\npip install async-multiplexer\n``` \n\n## Usage\n\n### Client\n```python\nimport asyncio\nfrom async_multiplexer import open_multiplexer_context\n\nasync def echo_client():\n    async with open_multiplexer_context(\"127.0.0.1\", 7777) as multiplexer:\n        stream_echo_1 = await multiplexer.multiplex(\"echo.1\")\n        stream_echo_2 = await multiplexer.multiplex(\"echo.2\")\n        await stream_echo_1.write(b\"echo.1\")\n        await stream_echo_2.write(b\"echo.2\")\n\n\nif __name__ == \"__main__\":\n    asyncio.run(echo_client())\n```\n\n### Server\n```python\nimport asyncio\nfrom async_multiplexer import bind_multiplex_listener_context\n\nasync def handler(stream):\n    data = await stream.read()\n    print(data)\n\nasync def echo_server():\n    async with bind_multiplex_listener_context(\"127.0.0.1\", 7777) as listener:\n        listener.set_handler(\"echo.1\", handler)\n        listener.set_handler(\"echo.2\", handler)\n        await asyncio.sleep(10)\n\nif __name__ == \"__main__\":\n    asyncio.run(echo_server())\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faratz-lasa%2Fasync-multiplexer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faratz-lasa%2Fasync-multiplexer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faratz-lasa%2Fasync-multiplexer/lists"}