remove timeout on connection open

This commit is contained in:
Liran Cohen 2023-01-23 13:52:32 -05:00 committed by Kieran
parent 501b42fc9a
commit 822247e1fa
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -126,12 +126,8 @@ export default class Connection {
OnOpen(e: Event) {
this.ConnectTimeout = DefaultConnectTimeout;
this._InitSubscriptions();
console.log(`[${this.Address}] Open!`);
setTimeout(() => {
if(this.Authed || this.AwaitingAuth.size === 0) {
this._InitSubscriptions();
}
}, 150)
}
OnClose(e: CloseEvent) {
@ -349,6 +345,10 @@ export default class Connection {
}
_SendJson(obj: any) {
if(!this.Authed && this.AwaitingAuth.size > 0) {
this.Pending.push(obj);
return;
}
if (this.Socket?.readyState !== WebSocket.OPEN) {
this.Pending.push(obj);
return;
@ -456,4 +456,4 @@ export default class Connection {
}
return ev;
}
}
}