[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4842":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":32,"discoverSource":33},4842,"websocketd","joewalnes\u002Fwebsocketd","joewalnes","Turn any program that uses STDIN\u002FSTDOUT into a WebSocket server. Like inetd, but for WebSockets. ","http:\u002F\u002Fwebsocketd.com\u002F",null,"Go",17464,1011,358,9,0,2,8,15,44.02,"BSD 2-Clause \"Simplified\" License",false,"master",true,[26,27,28],"proxy","websocket-server","websockets","2026-06-12 02:01:04","websocketd\n==========\n\n`websocketd` is a small command-line tool that will wrap an existing command-line interface program, and allow it to be accessed via a WebSocket.\n\nWebSocket-capable applications can now be built very easily. As long as you can write an executable program that reads `STDIN` and writes to `STDOUT`, you can build a WebSocket server. Do it in Python, Ruby, Perl, Bash, .NET, C, Go, PHP, Java, Clojure, Scala, Groovy, Expect, Awk, VBScript, Haskell, Lua, R, whatever! No networking libraries necessary.\n\n-[@joewalnes](https:\u002F\u002Ftwitter.com\u002Fjoewalnes)\n\nDetails\n-------\n\nUpon startup, `websocketd` will start a WebSocket server on a specified port, and listen for connections.\n\nUpon a connection, it will fork the appropriate process, and disconnect the process when the WebSocket connection closes (and vice-versa).\n\nAny message sent from the WebSocket client will be piped to the process's `STDIN` stream, followed by a `\\n` newline.\n\nAny text printed by the process to `STDOUT` shall be sent as a WebSocket message whenever a `\\n` newline is encountered.\n\n\nDownload\n--------\n\nIf you're on a Mac, you can install `websocketd` using [Homebrew](http:\u002F\u002Fbrew.sh\u002F). Just run `brew install websocketd`. For other operating systems, or if you don't want to use Homebrew, check out the link below.\n\n**[Download for Linux, OS X and Windows](https:\u002F\u002Fgithub.com\u002Fjoewalnes\u002Fwebsocketd\u002Fwiki\u002FDownload-and-install)**\n\n\nQuickstart\n----------\n\nTo get started, we'll create a WebSocket endpoint that will accept connections, then send back messages, counting to 10 with 1 second pause between each one, before disconnecting.\n\nTo show how simple it is, let's do it in Bash!\n\n__count.sh__:\n\n```sh\n#!\u002Fbin\u002Fbash\nfor ((COUNT = 1; COUNT \u003C= 10; COUNT++)); do\n  echo $COUNT\n  sleep 1\ndone\n```\n\nBefore turning it into a WebSocket server, let's test it from the command line. The beauty of `websocketd` is that servers work equally well in the command line, or in shell scripts, as they do in the server - with no modifications required.\n\n```sh\n$ chmod +x count.sh\n$ .\u002Fcount.sh\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n```\n\nNow let's turn it into a WebSocket server:\n\n```sh\n$ websocketd --port=8080 .\u002Fcount.sh\n```\n\nFinally, let's create a web-page to test it.\n\n__count.html__:\n\n```html\n\u003C!DOCTYPE html>\n\u003Cpre id=\"log\">\u003C\u002Fpre>\n\u003Cscript>\n  \u002F\u002F helper function: log message to screen\n  function log(msg) {\n    document.getElementById('log').textContent += msg + '\\n';\n  }\n\n  \u002F\u002F setup websocket with callbacks\n  var ws = new WebSocket('ws:\u002F\u002Flocalhost:8080\u002F');\n  ws.onopen = function() {\n    log('CONNECT');\n  };\n  ws.onclose = function() {\n    log('DISCONNECT');\n  };\n  ws.onmessage = function(event) {\n    log('MESSAGE: ' + event.data);\n  };\n\u003C\u002Fscript>\n```\nOpen this page in your web-browser. It will even work if you open it directly\nfrom disk using a `file:\u002F\u002F` URL.\n\nMore Features\n-------------\n\n*   Very simple install. Just [download](https:\u002F\u002Fgithub.com\u002Fjoewalnes\u002Fwebsocketd\u002Fwiki\u002FDownload-and-install) the single executable for Linux, Mac or Windows and run it. Minimal dependencies, no installers, no package managers, no external libraries. Suitable for development and production servers.\n*   Server side scripts can access details about the WebSocket HTTP request (e.g. remote host, query parameters, cookies, path, etc) via standard [CGI environment variables](https:\u002F\u002Fgithub.com\u002Fjoewalnes\u002Fwebsocketd\u002Fwiki\u002FEnvironment-variables).\n*   As well as serving websocket daemons it also includes a static file server and classic CGI server for convenience.\n*   Command line help available via `websocketd --help`.\n*   Includes [WebSocket developer console](https:\u002F\u002Fgithub.com\u002Fjoewalnes\u002Fwebsocketd\u002Fwiki\u002FDeveloper-console) to make it easy to test your scripts before you've built a JavaScript frontend.\n*   [Examples in many programming languages](https:\u002F\u002Fgithub.com\u002Fjoewalnes\u002Fwebsocketd\u002Ftree\u002Fmaster\u002Fexamples) are available to help you getting started.\n\nUser Manual\n-----------\n\n**[More documentation in the user manual](https:\u002F\u002Fgithub.com\u002Fjoewalnes\u002Fwebsocketd\u002Fwiki)**\n\nExample Projects\n----------------\n\n*   [Plot real time Linux CPU\u002FIO\u002FMem stats to a HTML5 dashboard using websocketd and vmstat](https:\u002F\u002Fgithub.com\u002Fjoewalnes\u002Fweb-vmstats) _(for Linux)_\n*   [Arbitrary REPL in the browser using websocketd](https:\u002F\u002Fgithub.com\u002Frowanthorpe\u002Fws-repl)\n*   [Retrieve SQL data from server with LiveCode and webSocketd](https:\u002F\u002Fgithub.com\u002Fsamansjukur\u002Fwslc)\n*   [List files from a configured folder](https:\u002F\u002Fgithub.com\u002Fdbalakirev\u002Fdirectator) _(for Linux)_\n*   [Listen for gamepad events and report them to the system](https:\u002F\u002Fgithub.com\u002Fexperiment322\u002Fcontrolloid-server) _(this + android = gamepad emulator)_\n\nGot more examples? Open a pull request.\n\nMy Other Projects\n-----------------\n\n*   [ReconnectingWebSocket](https:\u002F\u002Fgithub.com\u002Fjoewalnes\u002Freconnecting-websocket) - Simplest way to add some robustness to your WebSocket connections.\n*   [Smoothie Charts](http:\u002F\u002Fsmoothiecharts.org\u002F) - JavaScript charts for streaming data.\n\nAnd [follow @joewalnes](https:\u002F\u002Ftwitter.com\u002Fjoewalnes)!\n","websocketd 是一个将任何使用 STDIN\u002FSTDOUT 的程序转换为 WebSocket 服务器的命令行工具。它通过监听指定端口上的 WebSocket 连接，并在连接时启动相应的进程，将客户端发送的消息传递给进程的 STDIN，同时将进程输出到 STDOUT 的内容作为 WebSocket 消息返回。这一工具支持多种编程语言，无需复杂的网络库即可快速构建 WebSocket 应用。适用于需要简单快捷地将现有命令行程序暴露为 WebSocket 服务的场景，如实时数据处理、简单的 Web 交互应用等。","2026-06-11 03:00:51","top_language"]