首页 » 前端 » NodeJS » 正文

安装WebSocket-Node

发布者:站点默认
2016/11/5 浏览数(2,759) 分类:NodeJS 评论(1)

目录

  1. 安装NodeJS
  2. 安装WebSocket-Node

安装NodeJS

参考这里

curl -sL https://rpm.nodesource.com/setup | bash -
yum install -y nodejs

安装WebSocket-Node

参考这里

npm install websocket

工具

forever是nodejs的守护进程,能够启动,停止,重启我们的app应用

forever start app.js
forever start -o console.log -e console.error app.js
forever restartall
forever stopall
forever list

遇到的问题

Specified protocol was not requested by the client

ws = new WebSocket(host);
// 改为
ws = new WebSocket(host,'echo-protocol');
点击返回顶部
  1. 留言
  2. 联系方式