websockify

0.13.0 · active · verified Thu Apr 16

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.

Common errors

Warnings

Install

Imports

Quickstart

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.

# Start websockify to proxy WebSocket connections on port 8080 to a VNC server on localhost:5901
websockify 8080 localhost:5901

# Or, to wrap a program (e.g., a simple telnet server) and proxy to it
# This example assumes 'nc' (netcat) is available and listening on port 2000
# In one terminal: nc -lk 2000 # (for Linux)
# In another terminal, start websockify wrapping nc:
websockify 2023 --wrap-mode=respawn -- nc -lk 2000

# Access via a WebSocket client (e.g., noVNC) pointing to ws://your_server_ip:8080 or ws://your_server_ip:2023

view raw JSON →