{"id":7862,"library":"websocket","title":"Websocket (gevent)","description":"The `websocket` library, version 0.2.1, released in 2011, provides a WebSocket client implementation specifically for use with the `gevent` asynchronous framework. This project is no longer actively maintained and is considered abandoned, making it unsuitable for modern Python development. Developers should use `websocket-client` for synchronous applications or `websockets` for asyncio-based applications instead.","status":"abandoned","version":"0.2.1","language":"python","source_language":"en","source_url":"https://github.com/aaugustin/python-websocket","tags":["websocket","gevent","networking","abandoned"],"install":[{"cmd":"pip install websocket","lang":"bash","label":"Install websocket 0.2.1"},{"cmd":"pip install websocket-client","lang":"bash","label":"Install modern alternative: websocket-client"},{"cmd":"pip install websockets","lang":"bash","label":"Install modern alternative: websockets (asyncio)"}],"dependencies":[{"reason":"This library is designed as a WebSocket implementation specifically for the gevent asynchronous framework.","package":"gevent","optional":false}],"imports":[{"wrong":"from websocket import create_connection","symbol":"WebSocket","correct":"from websocket import WebSocket"}],"quickstart":{"code":"import os\nimport gevent\nfrom gevent import monkey; monkey.patch_all()\nfrom websocket import create_connection\n\ntry:\n    # Note: Many modern servers may not support the old protocol handshake\n    # This example connects to a public echo server that might be lenient.\n    ws_url = os.environ.get('WEBSOCKET_URL', 'ws://echo.websocket.events/')\n    print(f\"Connecting to {ws_url} with gevent-based websocket...\")\n    ws = create_connection(ws_url)\n    print(\"Sending 'Hello, World!'...\")\n    ws.send(\"Hello, World!\")\n    print(\"Receiving...\")\n    result = ws.recv()\n    print(f\"Received: '{result}'\")\n    ws.close()\n    print(\"Connection closed.\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"This library is very old and may not be compatible with modern WebSocket servers or Python environments.\")\n    print(\"Consider using 'websocket-client' or 'websockets' instead.\")","lang":"python","description":"This quickstart demonstrates a basic WebSocket client connection using the `websocket` library, patching `gevent` for its asynchronous operations. It attempts to connect to a public echo server and send/receive a message. Due to the library's age, compatibility with modern WebSocket servers is not guaranteed. Ensure `gevent` is installed alongside `websocket` for this to run."},"warnings":[{"fix":"Migrate to `websocket-client` (synchronous) or `websockets` (asyncio) for current Python projects.","message":"This library is fundamentally incompatible with modern WebSocket protocol versions and Python standards. Its last release was in 2011, predating significant advancements and RFC finalizations (e.g., RFC 6455). Using it will likely result in connection failures or unexpected behavior with contemporary WebSocket servers.","severity":"breaking","affected_versions":"0.2.1 and earlier"},{"fix":"Always use `pip install websocket-client` for the modern synchronous client or `pip install websockets` for the asyncio client. Verify your `requirements.txt` and import statements.","message":"The `websocket` package (0.2.1, gevent-based) is a distinct, abandoned library, often confused with the actively maintained `websocket-client` package. Importing `websocket` will install the old version, not the modern client.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to a modern WebSocket library like `websocket-client` or `websockets` that fully implements RFC 6455 and newer extensions.","message":"The library relies on a very old version of the WebSocket protocol (likely HyBi-00 to HyBi-07, pre-RFC 6455), which is not fully supported or implemented by most modern WebSocket servers. Connections will often fail during the handshake or exhibit unexpected frame handling.","severity":"deprecated","affected_versions":"0.2.1 and earlier"}],"env_vars":null,"search_vec":"'0.2.1':7 '2011':10 'abandon':34,62 'activ':29 'applic':50,57 'asynchron':22 'asyncio':55 'asyncio-bas':54 'base':56 'client':14,47 'consid':33 'develop':41,42 'framework':23 'gevent':2,21,60 'implement':15 'instead':58 'librari':5 'longer':28 'maintain':30 'make':35 'modern':39 'network':61 'project':25 'provid':11 'python':40 'releas':8 'specif':16 'synchron':49 'unsuit':37 'use':18,44 'version':6 'websocket':1,4,13,46,52,59 'websocket-cli':45","created_at":"2026-04-16T14:16:35.848122+00:00","updated_at":"2026-04-16T14:16:35.848122+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.2.1","cli_name":"","cli_version":null,"type":"library","homepage":"http://pypi.python.org/pypi/websocket","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/websocket/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","web-framework","communication"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}