{"id":20715402,"url":"https://github.com/codler/python-websocket","last_synced_at":"2025-07-11T12:06:29.207Z","repository":{"id":138047707,"uuid":"1140100","full_name":"codler/Python-WebSocket","owner":"codler","description":"Python websocket - asynchronous socket - draft-ietf-hybi-thewebsocketprotocol-00","archived":false,"fork":false,"pushed_at":"2010-12-31T10:44:57.000Z","size":101,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-11T07:17:35.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codler.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-12-05T10:45:26.000Z","updated_at":"2015-10-23T09:26:05.000Z","dependencies_parsed_at":"2023-03-16T18:49:14.418Z","dependency_job_id":null,"html_url":"https://github.com/codler/Python-WebSocket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codler/Python-WebSocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codler%2FPython-WebSocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codler%2FPython-WebSocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codler%2FPython-WebSocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codler%2FPython-WebSocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codler","download_url":"https://codeload.github.com/codler/Python-WebSocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codler%2FPython-WebSocket/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264803658,"owners_count":23666512,"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":[],"created_at":"2024-11-17T02:38:21.080Z","updated_at":"2025-07-11T12:06:29.155Z","avatar_url":"https://github.com/codler.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python WebSocket\n\n* Tested and works on Python 2.5\n\n* PROTOCOL - draft-hixie-thewebsocketprotocol-76 / draft-ietf-hybi-thewebsocketprotocol-00\n\n* CONNECTION METHOD - Asynchronous socket (RECOMMEND) / \"One-thread-per-connection\" (no longer maintained)\n\n## How to use\n\n\tclass WebSocketHandler(BaseWebSocketHandler):\n\t\tdef onconnect(self):\n\t\t\tpass\n\n\t\tdef onrecieve(self, message):\n\t\t\tfor connection in self.connections:\n\t\t\t\tself.onsend(connection, message)\n\n\t\tdef onsend(self, connection, message):\n\t\t\tif isinstance(message, unicode):\n\t\t\t\tmessage = message.encode('utf-8')\n\t\t\telif not isinstance(message, str):\n\t\t\t\tmessage = str(message)\n\t\t\tconnection.send(\"\\x00%s\\xff\" % message)\n\n\t\tdef ondisconnect(self):\n\t\t\tpass\n\n#### Some notes\n* One-thread-per-connection takes about \u003e8MB RAM for each connection! I recommend using asynchronous-socket instead.\n\n* Bug, \"self.server.connections\" does not always remove unused connection from the list.\n\n## Feedback\n\nI appreciate all feedback, thanks!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodler%2Fpython-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodler%2Fpython-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodler%2Fpython-websocket/lists"}