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 {
|
export interface MMWebSocketClient {
|
||||||
conn: WebSocket | null;
|
conn: WebSocket | null;
|
||||||
sendMessage(action: string, data: any, responseCallback?: () => void): void /* eslint-disable-line @typescript-eslint/no-explicit-any */
|
sendMessage(action: string, data: any, responseCallback?: () => void): void /* eslint-disable-line @typescript-eslint/no-explicit-any */
|
||||||
setFirstConnectCallback(callback: () => void): void
|
addFirstConnectListener(callback: () => void): void
|
||||||
setReconnectCallback(callback: () => void): void
|
addReconnectListener(callback: () => void): void
|
||||||
setErrorCallback(callback: (event: Event) => void): void
|
addErrorListener(callback: (event: Event) => void): void
|
||||||
setCloseCallback(callback: (connectFailCount: number) => void): void
|
addCloseListener(callback: (connectFailCount: number) => void): void
|
||||||
}
|
}
|
||||||
|
|
||||||
type OnChangeHandler = (client: WSClient, items: any[]) => void
|
type OnChangeHandler = (client: WSClient, items: any[]) => void
|
||||||
|
@ -368,10 +368,10 @@ class WSClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.client.setFirstConnectCallback(onConnect)
|
this.client.addFirstConnectListener(onConnect)
|
||||||
this.client.setErrorCallback(onError)
|
this.client.addErrorListener(onError)
|
||||||
this.client.setCloseCallback(onClose)
|
this.client.addCloseListener(onClose)
|
||||||
this.client.setReconnectCallback(onReconnect)
|
this.client.addReconnectListener(onReconnect)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue