{ "info": { "author": "Mark E. Haase", "author_email": "mehaase@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries" ], "description": "# Trio WebSocket\n\nThis library implements [the WebSocket\nprotocol](https://tools.ietf.org/html/rfc6455), striving for safety,\ncorrectness, and ergonomics. It is based on the [wsproto\nproject](https://wsproto.readthedocs.io/en/latest/), which is a\n[Sans-IO](https://sans-io.readthedocs.io/) state machine that implements the\nmajority of the WebSocket protocol, including framing, codecs, and events. This\nlibrary handles I/O using [the Trio\nframework](https://trio.readthedocs.io/en/latest/). This library passes the\n[Autobahn Test Suite](https://github.com/crossbario/autobahn-testsuite).\n\nThis README contains a brief introduction to the project. Full documentation [is\navailable here](https://trio-websocket.readthedocs.io).\n\n[![PyPI](https://img.shields.io/pypi/v/trio-websocket.svg?style=flat-square)](https://pypi.org/project/trio-websocket/)\n![Python Versions](https://img.shields.io/pypi/pyversions/trio-websocket.svg?style=flat-square)\n![MIT License](https://img.shields.io/github/license/HyperionGray/trio-websocket.svg?style=flat-square)\n[![Build Status](https://img.shields.io/travis/com/HyperionGray/trio-websocket.svg?style=flat-square&branch=master)](https://travis-ci.com/HyperionGray/trio-websocket)\n[![Coverage](https://img.shields.io/coveralls/github/HyperionGray/trio-websocket.svg?style=flat-square)](https://coveralls.io/github/HyperionGray/trio-websocket?branch=master)\n[![Read the Docs](https://img.shields.io/readthedocs/trio-websocket.svg)](https://trio-websocket.readthedocs.io)\n\n## Installation\n\nThis library requires Python 3.5 or greater. To install from PyPI:\n\n pip install trio-websocket\n\n## Client Example\n\nThis example demonstrates how to open a WebSocket URL:\n\n```python\nimport trio\nfrom sys import stderr\nfrom trio_websocket import open_websocket_url\n\n\nasync def main():\n try:\n async with open_websocket_url('wss://echo.websocket.org') as ws:\n await ws.send_message('hello world!')\n message = await ws.get_message()\n print('Received message: %s' % message)\n except OSError as ose:\n print('Connection attempt failed: %s' % ose, file=stderr)\n\ntrio.run(main)\n```\n\nThe WebSocket context manager connects automatically before entering the block\nand disconnects automatically before exiting the block. The full API offers a\nlot of flexibility and additional options.\n\n## Server Example\n\nA WebSocket server requires a bind address, a port, and a coroutine to handle\nincoming connections. This example demonstrates an \"echo server\" that replies to\neach incoming message with an identical outgoing message.\n\n```python\nimport trio\nfrom trio_websocket import serve_websocket, ConnectionClosed\n\nasync def echo_server(request):\n ws = await request.accept()\n while True:\n try:\n message = await ws.get_message()\n await ws.send_message(message)\n except ConnectionClosed:\n break\n\nasync def main():\n await serve_websocket(echo_server, '127.0.0.1', 8000, ssl_context=None)\n\ntrio.run(main)\n```\n\nThe server's handler ``echo_server(\u2026)`` receives a connection request object.\nThis object can be used to inspect the client's request and modify the\nhandshake, then it can be exchanged for an actual WebSocket object ``ws``.\nAgain, the full API offers a lot of flexibility and additional options.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/HyperionGray/trio-websocket", "keywords": "websocket client server trio", "license": "", "maintainer": "", "maintainer_email": "", "name": "trio-websocket", "package_url": "https://pypi.org/project/trio-websocket/", "platform": "", "project_url": "https://pypi.org/project/trio-websocket/", "project_urls": { "Bug Reports": "https://github.com/HyperionGray/trio-websocket/issues", "Homepage": "https://github.com/HyperionGray/trio-websocket", "Source": "https://github.com/HyperionGray/trio-websocket" }, "release_url": "https://pypi.org/project/trio-websocket/0.8.0/", "requires_dist": null, "requires_python": ">=3.5", "summary": "WebSocket library for Trio", "version": "0.8.0" }, "last_serial": 5432383, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "10523b71604e6fef5874d3b94fac875c", "sha256": "98a80addb1b1d4b00a0d4d8ec25e87cfa85241cb7ec182f86a2384eb36fd8f66" }, "downloads": -1, "filename": "trio-websocket-0.0.1.tar.gz", "has_sig": false, "md5_digest": "10523b71604e6fef5874d3b94fac875c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6930, "upload_time": "2018-09-07T19:37:15", "url": "https://files.pythonhosted.org/packages/fd/7c/d6b15d4c48f97da39de6ef6ad2e9009de7075dcdda7c1d7fcd26e3db75c6/trio-websocket-0.0.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "e620f265fe2e7b0a40d4f3911eb0f9f6", "sha256": "8ec4694070ba6b453303c8de670ffe449fadfac049b437e39592af17b88d340e" }, "downloads": -1, "filename": "trio-websocket-0.2.0.tar.gz", "has_sig": false, "md5_digest": "e620f265fe2e7b0a40d4f3911eb0f9f6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12867, "upload_time": "2018-10-17T16:01:17", "url": "https://files.pythonhosted.org/packages/6e/51/4874c1d2df060ed2f2143a0efa5076b373cd754c9216379b7fdc474e523f/trio-websocket-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "383bde3a9e6a15b4dd8e6da9975b48b5", "sha256": "44a8f85a638067d777ab9e167ea571ded7208e51af97a017848c83ed64ab1b4d" }, "downloads": -1, "filename": "trio-websocket-0.3.0.tar.gz", "has_sig": false, "md5_digest": "383bde3a9e6a15b4dd8e6da9975b48b5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 11660, "upload_time": "2018-10-29T18:29:34", "url": "https://files.pythonhosted.org/packages/d8/e8/ec73081cb37817652d9c0952fc6b7b99aa2a2987bc5fcbc26a47ce14fb85/trio-websocket-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "492904aa251d6a5efde59843ad930468", "sha256": "a240e2425e531d842777f4eaebaaa2b2b2727586be969e7cceaa624136fe84ad" }, "downloads": -1, "filename": "trio-websocket-0.4.0.tar.gz", "has_sig": false, "md5_digest": "492904aa251d6a5efde59843ad930468", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12817, "upload_time": "2018-11-21T17:08:27", "url": "https://files.pythonhosted.org/packages/03/5e/edf8b0d9eac6a12fb0af7d6ec0e9d6393edfa32cf5193fb1d6ef78365c05/trio-websocket-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "8dfd1126622abb8df827cfaf5de46423", "sha256": "f8b372ab5f321ce85dfbba861c5e546fb6768753719f7564db689b8c407e4019" }, "downloads": -1, "filename": "trio-websocket-0.5.0.tar.gz", "has_sig": false, "md5_digest": "8dfd1126622abb8df827cfaf5de46423", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12771, "upload_time": "2019-01-15T15:11:05", "url": "https://files.pythonhosted.org/packages/91/b1/4e0de4a192c4700ef7fccda326595a0e2c16da643d88e1580df1094ae0fd/trio-websocket-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "46a02076740da3c4810706ec0f4188e1", "sha256": "07996e041f960f0ebc5925f0036ea63363a1f28785a1f322657c23c48996189c" }, "downloads": -1, "filename": "trio-websocket-0.6.0.tar.gz", "has_sig": false, "md5_digest": "46a02076740da3c4810706ec0f4188e1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 12875, "upload_time": "2019-02-12T15:29:53", "url": "https://files.pythonhosted.org/packages/14/26/c90e100994b4ebcae22a402122672be753703400897af659b2a8b294dc15/trio-websocket-0.6.0.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "594e491badd05b34dd6d5bba48680aa0", "sha256": "bd643ce92de62871ecd2e27542e4a6d1ec175e0e0bb83665bd0b8df96d272d7f" }, "downloads": -1, "filename": "trio-websocket-0.7.0.tar.gz", "has_sig": false, "md5_digest": "594e491badd05b34dd6d5bba48680aa0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 16034, "upload_time": "2019-05-20T14:04:56", "url": "https://files.pythonhosted.org/packages/1d/5b/40c701f1ddadf1b8e055b2378fe992acd43de1c3e72a07807f327fe5f390/trio-websocket-0.7.0.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "b9e476df2c6947bffb9f059ce66c77a4", "sha256": "2f6c1f2ac87640e7b4539db723d336873149057caec4aac3b56af02de4cd47f0" }, "downloads": -1, "filename": "trio-websocket-0.8.0.tar.gz", "has_sig": false, "md5_digest": "b9e476df2c6947bffb9f059ce66c77a4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 16387, "upload_time": "2019-06-21T18:58:18", "url": "https://files.pythonhosted.org/packages/4a/da/7651f2d7dff8e4ea917683e683e95e1a1ef0ff90dbae7cddfc808c9dd277/trio-websocket-0.8.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b9e476df2c6947bffb9f059ce66c77a4", "sha256": "2f6c1f2ac87640e7b4539db723d336873149057caec4aac3b56af02de4cd47f0" }, "downloads": -1, "filename": "trio-websocket-0.8.0.tar.gz", "has_sig": false, "md5_digest": "b9e476df2c6947bffb9f059ce66c77a4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 16387, "upload_time": "2019-06-21T18:58:18", "url": "https://files.pythonhosted.org/packages/4a/da/7651f2d7dff8e4ea917683e683e95e1a1ef0ff90dbae7cddfc808c9dd277/trio-websocket-0.8.0.tar.gz" } ] }