websocket

ws - websocket over http wss - websocket over https

ssl - WSS works on http? - Stack Overflowopen in new window

  • http 可连接 https,所以 http 应该可连 wss
  • localhost 不受限制

websocket 是浏览器标准 nodejs 常用这个 https://github.com/websockets/ws koa2 用这个 koa-websocket 或 koa-socket

编写聊天室 - 廖雪峰的官方网站open in new window

测试连接

yarn global add wscatwscat -c ws://localhost:8083

fireship-io/socketio-minimal-demo: Minimal socket.io group chat demoopen in new window

socket.io

库,支持自动降级(HTTP轮询)和重连

Socket.IO minimal example - CodeSandboxopen in new window

Last Updated:
Contributors: cyio