linux 安装 websocketd
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了linux 安装 websocketd,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1741字,纯文字阅读大概需要3分钟。
内容图文
1.下载
wget https://github.com/joewalnes/websocketd/releases/download/v0.3.0/websocketd-0.3.0-linux_amd64.zip
注意是amd架构
2.解压
unzip websocketd-0.3.0-linux_amd64.zip
3.复制websocketd到/usr/bin
cp ./websocketd /usr/bin/websocketd
4.添加到path
echo "export PATH=$PATH:/usr/bin/websocketd" >> /etc/profile
source /etc/profile
5.启动服务
websocketd --help # 查看帮助 [root@localhost-db01 ~]# websocketd --address=0.0.0.0 --port=8888 ls Sun, 30 Jun 2019 15:33:03 +0800 | INFO | server | | Serving using application : /usr/bin/ls Sun, 30 Jun 2019 15:33:03 +0800 | INFO | server | | Starting WebSocket server : ws://0.0.0.0:8888/ Sun, 30 Jun 2019 15:34:23 +0800 | ACCESS | session | url:'http://192.168.0.202:8888/' id:'1561880063708057217' remote:'192.168.0.186' command:'/usr/bin/ls' origin:'file://' | CONNECT Sun, 30 Jun 2019 15:34:23 +0800 | ACCESS | session | url:'http://192.168.0.202:8888/' id:'1561880063708057217' remote:'192.168.0.186' command:'/usr/bin/ls' origin:'file://' pid:'11249' | DISCONNECT Sun, 30 Jun 2019 15:34:26 +0800 | ACCESS | session | url:'http://192.168.0.202:8888/' id:'1561880066921139807' remote:'192.168.0.186' command:'/usr/bin/ls' origin:'file://' | CONNECT Sun, 30 Jun 2019 15:34:26 +0800 | ACCESS | session | url:'http://192.168.0.202:8888/' id:'1561880066921139807' remote:'192.168.0.186' command:'/usr/bin/ls' origin:'file://' pid:'11253' | DISCONNECT
浏览器 console 测试连接,可以看到 ls 命令的输出:
var ws = new WebSocket('ws://ip:port'); ws.onopen = function(event){console.log("CONNECT")}; ws.onmessage = function(event){console.log(event.data)}; ws.onerror = function(event){console.log(event)};
mac上安装
https://blog.just4fun.site/websocketd.html
websocket 介绍
http://www.ruanyifeng.com/blog/2017/05/websocket.html
内容总结
以上是互联网集市为您收集整理的linux 安装 websocketd全部内容,希望文章能够帮你解决linux 安装 websocketd所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。