{ "info": { "author": "Kai Bailey", "author_email": "kbailey1@ualberta.ca", "bugtrack_url": null, "classifiers": [], "description": "# WebSock\n\n[![PyPI](https://img.shields.io/pypi/v/websock.svg)](https://pypi.org/project/websock/)\n[![Build Status](https://travis-ci.org/Kai-Bailey/WebSock.svg?branch=master)](https://travis-ci.org/Kai-Bailey/WebSock)\n\n\n\nA lightweight, multithreaded WebSocket server written in Python. \n\n## Example Use Case - Chat Application\n\nTo demonstrate one use case for WebSock, an online chat application has been set up [here](http://websock-chat.ml/). The application's backend server is built on top of WebSock and is deployed within a Docker container hosted by Digital Ocean. The code for the chat application is provided within the [examples directory](https://github.com/Kai-Bailey/WebSock/tree/master/examples).\n\n## Description\n\nWebSock is a Python implementation of a WebSocket server. WebSock allows you to create real-time applications, such as chatrooms or stock dashboards, without having to implement all the low-level details specified in the WebSocket protocol. The server application is built using the [TCP socket module](https://docs.python.org/3/howto/sockets.html) provided by the Python programming language and follows the latest version of the WebSocket protocol specification ([RFC 6455](https://datatracker.ietf.org/doc/rfc6455/)). The project was motivated by our desire to learn more about how data is transferred across networks while providing a useful tool for others to build on top of.\n\n## Design\nWebSock is an abstraction that hides the unnecessary complexities of the WebSocket protocol and provides a simple API that allows users to get their applications up and running quickly. The server listens for new client connections on its main application thread while offloading the management of individual client interactions to a dedicated client thread -- creating a new thread for each client connection. Client threads are created the moment an upgrade request is received and are destroyed following the transmission of the final close frame. This design allows the server to manage multiple clients concurrently without the concern of a non-responding client blocking the transmission of data to/from other clients.\n\n## How to Run\n\nInstall the library by executing:\n\n```python\npip install websock\n```\n\nWebSock's API is easy to integrate into any application. To use the server you must provide an implementation for any or all of the following methods:\n\n```python\ndef on_data_receive(client, data):\n '''Called by the WebSocket server when data is received.'''\n # Your implementation here.\n\ndef on_connection_open(client):\n '''Called by the WebSocket server when a new connection is opened.'''\n # Your implementation here.\n \ndef on_error(exception):\n '''Called by the WebSocket server whenever an Exception is thrown.'''\n # Your implementation here.\n \ndef on_connection_close(client):\n '''Called by the WebSocket server when a connection is closed.'''\n # Your implementation here.\n\ndef on_server_destruct():\n '''Called immediately prior to the WebSocket server shutting down.'''\n # Your implementation here.\n```\n\nThen, simply import and instantiate a new WebSocketServer object. The server expects a host and port, as well as any combination of the above methods.\n\n```python\nfrom websock import WebSocketServer\n\nmy_server = WebSocketServer(\n \"127.0.0.1\", # Example host.\n 8467, # Example port.\n on_data_receive = on_data_receive,\n on_connection_open = on_connection_open,\n on_error = on_error,\n on_connection_close = on_connection_close,\n on_server_destruct = on_server_destruct\n)\n\nmy_server.serve_forever()\n```\n\nFor more guidance, check out the code for the example chat application built using WebSock in the [examples directory](https://github.com/Kai-Bailey/WebSock/tree/master/examples).\n## API Documentation\nYou can check out the full documentation for the API [here](https://websock.readthedocs.io/en/latest/).\n\n## Authors\n* [Kai Bailey](https://github.com/Kai-Bailey) - Software engineering student at the University of Alberta.\n* [Fraser Bulbuc](https://github.com/fbulbuc) - Software engineering student at the University of Alberta.\n\n## References\n* The latest official WebSocket protocol specification, [RFC 6455](https://datatracker.ietf.org/doc/rfc6455/).\n* Mozilla has an abundance of information on web technologies including a section on [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API).\n* A chat bot, built using [ChatterBot](https://github.com/gunthercox/ChatterBot), was added to the example chat application so that the chat room is never empty!\n\n## Future Development\n\n* Integration of the [Autobahn test suite](https://github.com/crossbario/autobahn-testsuite) to verify protocol coverage.", "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/Kai-Bailey/websocket", "keywords": "websocket client server multithreaded", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "websock", "package_url": "https://pypi.org/project/websock/", "platform": "", "project_url": "https://pypi.org/project/websock/", "project_urls": { "Homepage": "https://github.com/Kai-Bailey/websocket" }, "release_url": "https://pypi.org/project/websock/1.0.3/", "requires_dist": null, "requires_python": "", "summary": "Multithreaded websocket server following RFC 6455 protocol", "version": "1.0.3" }, "last_serial": 5809943, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "1672aa2a7a037c71d322d84976a77b8f", "sha256": "f387e3d2e8695577d560ea1c1dbff46d5ff47b554aeb6f207993f22d25e014bc" }, "downloads": -1, "filename": "websock-0.0.1-py3.6.egg", "has_sig": false, "md5_digest": "1672aa2a7a037c71d322d84976a77b8f", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 16208, "upload_time": "2018-07-19T16:31:23", "url": "https://files.pythonhosted.org/packages/49/3c/80c745fdaea4b87dc78b8c845b8a3266fb54ceee8d7f9c32a7b3ccf8f91b/websock-0.0.1-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "499bfe628a17365422b2290306fb8f60", "sha256": "05d9736d4e4514ff940e70927f2c3702cb8fe18c11f9d04c21ab09c5802b7b5d" }, "downloads": -1, "filename": "websock-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "499bfe628a17365422b2290306fb8f60", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4334, "upload_time": "2018-07-10T04:20:17", "url": "https://files.pythonhosted.org/packages/15/84/f6c1cae647c63eb4936847ac9882a3110917470e517b7521bac8987ddd8b/websock-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ce6f8ae1b591008cbf32d9a679a41c7a", "sha256": "52592d1214bd13b65467a1aa249cfb6e6e7e3733982ce215f28f038d37d17265" }, "downloads": -1, "filename": "websock-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ce6f8ae1b591008cbf32d9a679a41c7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2225, "upload_time": "2018-07-10T04:20:18", "url": "https://files.pythonhosted.org/packages/0b/f8/88412255fba68357aad77175bd10dcf5cdc349df6b4d6fb7ca09c48120cf/websock-0.0.1.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "7f5ebab04ca198127f08534851647f2c", "sha256": "aff4f5eb11b800d7dc06f84ff660275e39f0df148a441282c7d9088aaaba7f3b" }, "downloads": -1, "filename": "websock-0.0.5-py3.6.egg", "has_sig": false, "md5_digest": "7f5ebab04ca198127f08534851647f2c", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 16209, "upload_time": "2018-07-19T16:31:24", "url": "https://files.pythonhosted.org/packages/65/c6/5b2a5e0b43a01f3310e9c18fd45a109fd9e9179361575e995003ecd99cb3/websock-0.0.5-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "9dd25872d6685b43c964c39ac98e9d85", "sha256": "3bf92d7b767b570f1290d2eade4d256eb3d27e9d95bb1ff035e75ecd07a47c33" }, "downloads": -1, "filename": "websock-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "9dd25872d6685b43c964c39ac98e9d85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10431, "upload_time": "2018-07-19T16:31:22", "url": "https://files.pythonhosted.org/packages/42/14/d50140be2c367608f3692cfdccb2edd4cfa2f92698e8989957408b28ea73/websock-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4357f2620e256d7bccacca4396724d63", "sha256": "389ed4fbefc6d554aa6d23554d0d7eb3e78c19f89feca0cbc26e9ee568ecbd03" }, "downloads": -1, "filename": "websock-0.0.5.tar.gz", "has_sig": false, "md5_digest": "4357f2620e256d7bccacca4396724d63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6956, "upload_time": "2018-07-19T16:31:25", "url": "https://files.pythonhosted.org/packages/56/d4/6377c2bc8f7577691b1425809a12f4bde5b75a528fef437713c3d4753d3a/websock-0.0.5.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "cd8fdc4927f80caca9391572682533bb", "sha256": "d9222cb70384e5a4ab3a892c491d48a6973c7add4875a8eeb55645b984b6facc" }, "downloads": -1, "filename": "websock-0.1.0.tar.gz", "has_sig": false, "md5_digest": "cd8fdc4927f80caca9391572682533bb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8035, "upload_time": "2018-08-01T02:58:56", "url": "https://files.pythonhosted.org/packages/7d/7b/5309d07e97646ffd86eb912c0c6eae7e7d96af11a4057fc4b55d5fe1dc2d/websock-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "36798b0f7eb348999343c11879664a54", "sha256": "798d57c9c8f1d4bea3ff7627e8086a28aaf919ee8347efc4238558af280d50cc" }, "downloads": -1, "filename": "websock-0.1.1.tar.gz", "has_sig": false, "md5_digest": "36798b0f7eb348999343c11879664a54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8054, "upload_time": "2018-08-01T03:25:56", "url": "https://files.pythonhosted.org/packages/ed/ff/9c69caac9ecd3af458dcd01b5e99499c644300d2128bfd4a59d3428de412/websock-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "dddc1ab812e4be0cedbbbd9655859a14", "sha256": "b2f8ee97dc83d30138020d0b882dbd4c1e4fd8bbf4d4a2129b2a63d332a95267" }, "downloads": -1, "filename": "websock-0.1.2.tar.gz", "has_sig": false, "md5_digest": "dddc1ab812e4be0cedbbbd9655859a14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8055, "upload_time": "2018-08-01T04:43:48", "url": "https://files.pythonhosted.org/packages/8c/42/2d9c7e397f81ca7293ea5f369c5373cdb77ce3383a6909755cb60104ddea/websock-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "73a06944363643fe7a4bd8b8ca3b6250", "sha256": "4876518840c970870779b09423eab2633a5a95a3b09245890639af5d1e55e2c1" }, "downloads": -1, "filename": "websock-0.1.3.tar.gz", "has_sig": false, "md5_digest": "73a06944363643fe7a4bd8b8ca3b6250", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8054, "upload_time": "2018-08-01T05:15:17", "url": "https://files.pythonhosted.org/packages/c9/79/ee66b94b1d64b3221789778373ce1ac07e1632304880e61f48617193a366/websock-0.1.3.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "baafcee577bfa3a8a10020f58ab4bf98", "sha256": "3661c89dcaa32d244cd8d0c0a4a587537aa89619a3420a16dfb15b76bb0d68b9" }, "downloads": -1, "filename": "websock-0.1.5.tar.gz", "has_sig": false, "md5_digest": "baafcee577bfa3a8a10020f58ab4bf98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7668, "upload_time": "2018-08-02T03:06:22", "url": "https://files.pythonhosted.org/packages/ba/2c/00ef23971bad82ea9933f27cca872b1a61917ea054aa68f5f802116f7396/websock-0.1.5.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "60aa982feefb274c00e9992b068ca3bf", "sha256": "7e56bcaae3ea94683016153d2fb67193c6995bdbf6f24d96dffecd0876e9ca55" }, "downloads": -1, "filename": "websock-0.1.7.tar.gz", "has_sig": false, "md5_digest": "60aa982feefb274c00e9992b068ca3bf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7958, "upload_time": "2018-08-04T22:25:29", "url": "https://files.pythonhosted.org/packages/15/32/934d4d581503d2a72e5926096cd5632e08d496acc0a2fa44e71ecdc5a0ce/websock-0.1.7.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1f4fb5516d7aac82edd34fa5ae334194", "sha256": "fb06e2f8ddbbe3f6578e27b93e614a17bb72321fb3c9a3b076722b510a27619b" }, "downloads": -1, "filename": "websock-0.2.0.tar.gz", "has_sig": false, "md5_digest": "1f4fb5516d7aac82edd34fa5ae334194", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7959, "upload_time": "2018-08-04T22:40:09", "url": "https://files.pythonhosted.org/packages/08/6a/89da809044ea82e221a1bf05c34dc20f1823feadd3069ccdf19f1d7355e7/websock-0.2.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "f1c75ae6ee05ce4d86be793b171da867", "sha256": "ad7e0d9742947b9c42dca551c0d2b815b54fa23be60cdc3647c45b2148fff5ef" }, "downloads": -1, "filename": "websock-1.0.0.tar.gz", "has_sig": false, "md5_digest": "f1c75ae6ee05ce4d86be793b171da867", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7960, "upload_time": "2018-08-05T15:33:23", "url": "https://files.pythonhosted.org/packages/be/40/6a6d07462a0a6d8c620eec54bf0565fa41be7b1b604b651e9e2264882593/websock-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "d684c41e8be87561e4c82a90c1301ed5", "sha256": "10104fc1240d123c22562150331a9a97bbf9a10e147ad6ae2d895b069317285e" }, "downloads": -1, "filename": "websock-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d684c41e8be87561e4c82a90c1301ed5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7957, "upload_time": "2018-08-26T20:14:05", "url": "https://files.pythonhosted.org/packages/7a/12/9731abd868d5066f9e340be961ea85940b67fb581964f6613bcec809d14a/websock-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "a6728bd13cc2e47fd57154c31b6ffc31", "sha256": "d1a607b37b3751c0194fd06e672eb4940cdb4b5d141f89c6ec5f2d855da4ed55" }, "downloads": -1, "filename": "websock-1.0.2.tar.gz", "has_sig": false, "md5_digest": "a6728bd13cc2e47fd57154c31b6ffc31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8018, "upload_time": "2019-09-04T16:20:11", "url": "https://files.pythonhosted.org/packages/67/91/163b7319daad4c790b0a54a44bb1d3f9f8cad8900cc77fc0bfda1ecf85f1/websock-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "a51737fae47b161371d829b9178abc9d", "sha256": "268b24643ccc274710c674679b3bb1c24b269795ce1d86e10bfb35b94a71b596" }, "downloads": -1, "filename": "websock-1.0.3.tar.gz", "has_sig": false, "md5_digest": "a51737fae47b161371d829b9178abc9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8085, "upload_time": "2019-09-10T16:25:58", "url": "https://files.pythonhosted.org/packages/d0/2f/7c1d942e0bd70740f550f57deac7e8101608947036ef50c7239c907d43d4/websock-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a51737fae47b161371d829b9178abc9d", "sha256": "268b24643ccc274710c674679b3bb1c24b269795ce1d86e10bfb35b94a71b596" }, "downloads": -1, "filename": "websock-1.0.3.tar.gz", "has_sig": false, "md5_digest": "a51737fae47b161371d829b9178abc9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8085, "upload_time": "2019-09-10T16:25:58", "url": "https://files.pythonhosted.org/packages/d0/2f/7c1d942e0bd70740f550f57deac7e8101608947036ef50c7239c907d43d4/websock-1.0.3.tar.gz" } ] }