page, a websocket is requested
wsCurrentEntrust: function () {
if ("WebSocket" in window) {
websocket = new WebSocket(host + userId);
}
else {
...
}
websocket.onerror = function () {
...
};
websocket.onopen = function (event) {
...
}
websocket.onmessage = function (event) {
...
}
websocket.onclose = function () {
...
}
}
for example, the url of the ws I requested at first is host1, and then I click a button and then it becomes host2, but the message of host1 is still being pushed, resulting in a problem with the callback of the function. After solving how to change to host2, the message of host1 is no longer pushed ~