im尝试在onerror或onclose之后在本机响应中建立持久的websocket连接。不会出现onmessage,onerror或onclose事件。在关闭连接之前,它工作正常
var socket = new WebSocket('url');
socket.send ('msg')
socket.onmessage = ({ data }) => {
process the message
}
socket.onerror = () => {
var socket = new WebSocket('url');
}
socket.onclose = () => {
var socket = new WebSocket('url');
}