let socket = new WebSocket('ws://echo.websocket.org/')
socket.addEventListener('open', e => {
console.log('open')
})
socket.addEventListener('message', e => {
console.log(e.data)
一直有个疑问:先创建连接,后注册事件,不会漏掉消息吗?
米琪卡哇伊
相关分类