About this project
websocketd provides a simple way to expose existing command-line programs over WebSockets without requiring networking libraries in the program itself. After starting on a chosen port, it accepts WebSocket connections and launches the configured executable for each connection. Messages from the browser are written to the process STDIN with a trailing newline, while newline-terminated STDOUT output is returned to the client as WebSocket messages. When either side disconnects, the associated process and its process group are shut down.
The backend program can be written in any language that supports standard input and output, including shell scripts, Python, Ruby, Perl, C, Go, PHP, Java, PowerShell, Lua, and R. Request information such as remote host, path, query parameters, and cookies is exposed to scripts through CGI environment variables.
Additional capabilities include a static file server, classic CGI support, listening on a Unix domain socket with configurable permissions, optional STDERR forwarding as tagged JSON, and a built-in WebSocket developer console for connecting, sending frames, and inspecting responses. The tool is distributed as a single standalone executable for Linux, macOS, and Windows, with Homebrew installation available on macOS. The repository also links to examples and sample projects involving real-time system statistics, browser-based REPLs, database access, file listing, and gamepad input.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.