If we leave component we can close WebSocket fine and anything is as expected. The problem is if the WebSocket is not connected and we set {"reconnectIfNotNormalClose": true} the Websocket could not by closed or interrupted.
we can see before set close command the readyState is 0 which means connecting and after forsce the close the state is 3 which means closed.
But the problem is, also after leaving the component and closed the websocket, the websocket is still attempting to reconnect the websocket.
close method could handle something like this:
$WebSocket.prototype.close = function (force) {
if (force === void 0) { force = false; }
if (force || !this.socket.bufferedAmount) {
this.socket.close(this.normalCloseCode);
// NEW CODE
this.config.reconnectIfNotNormalClose = false
// NEW CODE
}
return this;
};
If we leave component we can close
WebSocket
fine and anything is as expected. The problem is if theWebSocket
is not connected and we set{"reconnectIfNotNormalClose": true}
the Websocket could not by closed or interrupted.On leaving the component we do this
we can see before set close command the
readyState
is0
which meansconnecting
and afterforsce
theclose
thestate
is3
which meansclosed
. But the problem is, also after leaving the component and closed the websocket, the websocket is still attempting to reconnect the websocket.close method could handle something like this: