- `ws://${config.uiServer.host}:${config.uiServer.port}`,
- config.uiServer.protocol
- );
- this.ws.onmessage = this.responseHandler.bind(this);
- this.ws.onerror = (errorEvent) => {
- console.error('WebSocket error: ', errorEvent);
- };
- this.ws.onclose = (closeEvent) => {
- console.info('WebSocket closed: ', closeEvent);
- };
- }
-
- private setResponseHandler(
- id: string,
- procedureName: ProcedureName,
- resolve: (value: ResponsePayload | PromiseLike<ResponsePayload>) => void,
- reject: (reason?: unknown) => void
- ): void {
- this.responseHandlers.set(id, { procedureName, resolve, reject });
- }
-
- private getResponseHandler(id: string): ResponseHandler | undefined {
- return this.responseHandlers.get(id);
- }
-
- private deleteResponseHandler(id: string): boolean {
- return this.responseHandlers.delete(id);
+ `${this.uiServerConfiguration.secure === true ? ApplicationProtocol.WSS : ApplicationProtocol.WS}://${this.uiServerConfiguration.host}:${this.uiServerConfiguration.port}`,
+ protocols
+ )
+ this.ws.onopen = () => {
+ useToast().success(
+ `WebSocket to UI server '${this.uiServerConfiguration.host}' successfully opened`
+ )
+ }
+ this.ws.onmessage = this.responseHandler.bind(this)
+ this.ws.onerror = errorEvent => {
+ useToast().error(`Error in WebSocket to UI server '${this.uiServerConfiguration.host}'`)
+ console.error(
+ `Error in WebSocket to UI server '${this.uiServerConfiguration.host}'`,
+ errorEvent
+ )
+ }
+ this.ws.onclose = () => {
+ useToast().info(`WebSocket to UI server closed`)
+ }