websocket的几种测试方式

Posted by 刘勇(lyonger) on 2020-01-09

websocket的几种测试方式

Chrome浏览器插件测试

image

curl测试

1
curl -vk -H "host:xxx" -H "Upgrade: websocket" -H "Sec-WebSocket-Version: xx" -H "Sec-WebSocket-Key:xxx" -H "Connection: Upgrade" https://xxx.xxx.com

python测试

1
2
3
import websockets
websockets.connect('wss://xxx.xxx.com')
ws = websockets.connect('wss://xxx.xxx.com')

命令行测试

1
2
3
4
5
apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash
apt-get install nodejs
npm install -g ws wscat
wscat -c wss://xxx.xxx.com
  • npm install 使用root安装发生权限问题时可以使用npm install --production --unsafe-perm=true --allow-root -g xxx

推荐阅读



支付宝打赏 微信打赏

赞赏一下