Registry / http-networking / websocket

websocket

JSON →
library0.2.1pypypi✓ verified 84d ago

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.

pip install websocket
INSTALL
IMPORT
SIG · WEBSOCKET
W
websocket
http-networkingpythonv0.2.1
Install
2.3s avg
Import
112ms
Disk
49MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 2.2s
py 3.11
✓ —
✓ 2.18s
py 3.12
✓ —
✓ 2.33s
py 3.13
✓ —
✓ 2.29s
py 3.9
8/12 runs
8/12 runs
49MB installed
● package 49MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebSocket
✓ from websocket import WebSocket
✗ from websocket import create_connection

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.

import os import gevent from gevent import monkey; monkey.patch_all() from websocket import create_connection try: # Note: Many modern servers may not support the old protocol handshake # This example connects to a public echo server that might be lenient. ws_url = os.environ.get('WEBSOCKET_URL', 'ws://echo.websocket.events/') print(f"Connecting to {ws_url} with gevent-based websocket...") ws = create_connection(ws_url) print("Sending 'Hello, World!'...") ws.send("Hello, World!") print("Receiving...") result = ws.recv() print(f"Received: '{result}'") ws.close() print("Connection closed.") except Exception as e: print(f"An error occurred: {e}") print("This library is very old and may not be compatible with modern WebSocket servers or Python environments.") print("Consider using 'websocket-client' or 'websockets' instead.")
Debug
Known issues
breakingThis 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.
fix
Migrate to `websocket-client` (synchronous) or `websockets` (asyncio) for current Python projects.
affects: 0.2.1 and earlier
gotchaThe `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.
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.
affects: All versions
deprecatedThe 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.
fix
Upgrade to a modern WebSocket library like `websocket-client` or `websockets` that fully implements RFC 6455 and newer extensions.
affects: 0.2.1 and earlier
Upgrade
Version history
0.2.1latest on PyPI · released Dec 3, 2010
Audit
Dependencies
geventrequiredThis library is designed as a WebSocket implementation specifically for the gevent asynchronous framework.
Agent activity
48 hits · last 30 days
node
44
OpenAI (training)
1
Resources