Websockify is a Python library and tool that functions as a WebSocket to TCP proxy/bridge. It translates WebSocket traffic to normal socket traffic, enabling browsers to connect to any application or server. Originally part of the noVNC project, it is actively maintained, with releases typically occurring every few months, incorporating new features and compatibility updates.
pip install websockifyVerified import paths — ran on the pinned version, not inferred.
The primary way to use websockify is as a command-line tool to establish a WebSocket-to-TCP proxy. The first example proxies an existing TCP server (like VNC). The second example demonstrates 'wrap mode', where websockify launches and manages a target program, proxying to its standard I/O or a designated port.
Ensure you are running websockify with Python 3.6 or newer.
Update WebSocket clients to use the HyBi/IETF 6455 protocol and send binary data directly (not Base64 encoded). Clients must explicitly support 'binary' protocol.
Refer to the websockify GitHub release notes for v0.6.0 (specifically pull requests #110 and #111) for guidance on updating custom `WebsocketProxy` subclasses.
First, navigate to the HTTPS equivalent of your websockify server's address (e.g., `https://your_server_ip:8080`) in your browser and explicitly accept the self-signed certificate. Then, try the `wss://` connection. For production, use a trusted certificate authority.
Choose a different `source_port` that is not in use, or ensure that any previous websockify instances or other applications are fully terminated before restarting.
Navigate to the `websockify` source directory and run `make` to compile `rebind.so`. If it's compiled but still not found, check if `rebind.so` is in the expected `websockify/websockify/` directory, and move it there if necessary.
Ensure the WebSocket client is updated to a modern version that explicitly supports the 'binary' WebSocket sub-protocol as per HyBi/IETF 6455. Avoid older clients that implicitly rely on Base64 encoding.
Check server logs for specific HTTP status codes (e.g., 400, 401, 403, 404) that might indicate the root cause. Verify the WebSocket URL (ws:// vs wss://), firewall rules, authentication credentials, and ensure correct SSL certificate configuration.