forked from evs-broadcast/node-emberplus
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Thanks a lot for this project, I use it a lot.
I found one problem in the sockets event emitter:
When calling "disconnectAsync", the socket calls "handleClose", which will not emit "DISCONNECTED" because the socket status is already set to "disconnected" by some other process.
handleClose() {
this._socket = null;
this._clearTimers();
if (this._status !== 'disconnected') {
this._status = 'disconnected';
this.emit(S101SocketEvent.DISCONNECTED);
}
}
When adding an "else if" in case the socket status is already "disconnected", it works for me.
handleClose() {
this._socket = null;
this._clearTimers();
if (this._status !== 'disconnected') {
this._status = 'disconnected';
this.emit(S101SocketEvent.DISCONNECTED);
}
else if (this._status === 'disconnected') {
this.emit(S101SocketEvent.DISCONNECTED);
}
}
This could be a very specific problem for my use-case, as I am using the library in node-red, but maybe this helps somebody.
Metadata
Metadata
Assignees
Labels
No labels