命令行工具转 WebSocket 服务 websocketd
- 授权协议: BSD
- 开发语言: Google Go
- 操作系统: 跨平台
- 软件首页: https://github.com/joewalnes/websocketd
软件介绍
websocketd 是一个很小的命令后工具,可以让你的命令行接口程序封装成可通过 WebSocket 进行访问。
例如这样一个命令行程序 count.sh:
#!/bin/bash for COUNT in $(seq 1 10); do echo $COUNT sleep 1 done
可通过如下命令进行封装:
$ websocketd --port=8080 ./count.sh
然后你可以创建一个网页来测试 count.html:
<!DOCTYPE html>
<pre id="log"></pre>
<script>
// helper function: log message to screen
function log(msg) {
document.getElementById('log').textContent += msg + '\n';
}
// setup websocket with callbacks
var ws = new WebSocket('ws://localhost:8080/');
ws.onopen = function() {
log('CONNECT');
};
ws.onclose = function() {
log('DISCONNECT');
};
ws.onmessage = function(event) {
log('MESSAGE: ' + event.data);
};
</script>
Beginning ASP.NET 4 in C# and Vb
Imar Spaanjaars / Wrox / 2010-3-19 / GBP 29.99
This book is for anyone who wants to learn how to build rich and interactive web sites that run on the Microsoft platform. With the knowledge you gain from this book, you create a great foundation to ......一起来看看 《Beginning ASP.NET 4 in C# and Vb》 这本书的介绍吧!
