From 4b5152940db748bd1b29b8f5515cf5c2473fc31c Mon Sep 17 00:00:00 2001 From: Miguel de la Cruz Date: Fri, 29 Jul 2022 22:32:34 +0200 Subject: [PATCH] Update websocket client to use the new websocket lifecycle hooks (#3485) --- webapp/src/wsclient.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/webapp/src/wsclient.ts b/webapp/src/wsclient.ts index 1dede881e..f3ecb8a98 100644 --- a/webapp/src/wsclient.ts +++ b/webapp/src/wsclient.ts @@ -65,10 +65,10 @@ export interface Subscription { export interface MMWebSocketClient { conn: WebSocket | null; sendMessage(action: string, data: any, responseCallback?: () => void): void /* eslint-disable-line @typescript-eslint/no-explicit-any */ - setFirstConnectCallback(callback: () => void): void - setReconnectCallback(callback: () => void): void - setErrorCallback(callback: (event: Event) => void): void - setCloseCallback(callback: (connectFailCount: number) => void): void + addFirstConnectListener(callback: () => void): void + addReconnectListener(callback: () => void): void + addErrorListener(callback: (event: Event) => void): void + addCloseListener(callback: (connectFailCount: number) => void): void } type OnChangeHandler = (client: WSClient, items: any[]) => void @@ -368,10 +368,10 @@ class WSClient { } } - this.client.setFirstConnectCallback(onConnect) - this.client.setErrorCallback(onError) - this.client.setCloseCallback(onClose) - this.client.setReconnectCallback(onReconnect) + this.client.addFirstConnectListener(onConnect) + this.client.addErrorListener(onError) + this.client.addCloseListener(onClose) + this.client.addReconnectListener(onReconnect) return }