命令行工具转 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>
Web Design for ROI
Lance Loveday、Sandra Niehaus / New Riders Press / 2007-10-27 / USD 39.99
Your web site is a business--design it like one. Billions of dollars in spending decisions are influenced by web sites. So why aren't businesses laser-focused on designing their sites to maximize thei......一起来看看 《Web Design for ROI》 这本书的介绍吧!
