You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using SocketIO. I wonder if I'm using this correctly, but I'm losing callbacks in the actual socket object when socketFor is called during the socket is in disconnected state and the proxy object is updated with a new socket instance.
Initialize:
let socket = this.socketIOService.socketFor(url);
socket.on('myEvent', this.myHandler, this);
After this socket.listeners and socket.socket._callbacks contain all the added listeners.
Now if socket gets disconnected and I call again: this.socketIOService.socketFor(url);
Inside socketFor function this.isWebSocketOpen(existingProxy.socket) is false -> new socket is created and set to existingProxy: set(existingProxy, 'socket', newWebSocket);
After this socket.listeners contain added listeners, but socket.socket._callbacks does not. It only holds the default connecting and connect callbacks.
Is there something that I'm missing in the usage? Based on the examples socketFor seems to be a function that can be called several times. If I save the socket instance into a property and never call socketFor again, callbacks are working.
The text was updated successfully, but these errors were encountered:
Using SocketIO. I wonder if I'm using this correctly, but I'm losing callbacks in the actual socket object when socketFor is called during the socket is in disconnected state and the proxy object is updated with a new socket instance.
Initialize:
After this
socket.listeners
andsocket.socket._callbacks
contain all the added listeners.Now if socket gets disconnected and I call again:
this.socketIOService.socketFor(url);
Inside
socketFor
functionthis.isWebSocketOpen(existingProxy.socket)
is false -> new socket is created and set toexistingProxy
:set(existingProxy, 'socket', newWebSocket);
After this
socket.listeners
contain added listeners, butsocket.socket._callbacks
does not. It only holds the defaultconnecting
andconnect
callbacks.Is there something that I'm missing in the usage? Based on the examples
socketFor
seems to be a function that can be called several times. If I save the socket instance into a property and never callsocketFor
again, callbacks are working.The text was updated successfully, but these errors were encountered: