Update websocket client to use the new websocket lifecycle hooks (#3485)
This commit is contained in:
parent
ee395d49b1
commit
4b5152940d
1 changed files with 8 additions and 8 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue