messenger don't create new websocket if connecting

This commit is contained in:
Nate Sesti 2023-07-25 23:51:55 -07:00
parent fc66d0d8cc
commit 03da423e5a

View file

@ -108,7 +108,9 @@ export class WebsocketMessenger extends Messenger {
if (this.websocket.readyState === this.websocket.OPEN) {
this.websocket.send(payload);
} else {
this.websocket = this._newWebsocket();
if (this.websocket.readyState !== this.websocket.CONNECTING) {
this.websocket = this._newWebsocket();
}
this.websocket.addEventListener("open", () => {
this.websocket.send(payload);