rxjs
rxjs copied to clipboard
Unsubscribing from WebSocketSubject reference to Websocket
When unsubscribing from a multiplex WebSocketSubject I am seeing the socket getting set to null. There are still other subscribers and the socket still exists, but we are loosing the reference to the socket
I believe this was introduced in 62d242e.
Relevant Code
protected _subscribe(subscriber: Subscriber<T>): Subscription {
const { source } = this;
if (source) {
return source.subscribe(subscriber);
}
if (!this.socket) {
this._connectSocket();
}
let subscription = new Subscription();
subscription.add(this._output.subscribe(subscriber));
subscription.add(() => {
const { socket } = this;
if (this._output.observers.length === 0 && socket && socket.readyState === 1) {
socket.close();
}
this._resetState(); //This is where to socket reference is getting lost
});
return subscription;
}
Oops, yup, I see the bug there. Thanks @webstp
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.