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
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.fixMigrate 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.fixAlways 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.fixUpgrade 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.