From b109aa1c8ab09ae2ae2edc0704f017033071196d Mon Sep 17 00:00:00 2001 From: srgooglo Date: Mon, 10 Oct 2022 14:47:32 +0200 Subject: [PATCH] handle ws connections status message --- packages/app/src/App.jsx | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/packages/app/src/App.jsx b/packages/app/src/App.jsx index c5ba4294..7f32ee32 100644 --- a/packages/app/src/App.jsx +++ b/packages/app/src/App.jsx @@ -189,7 +189,7 @@ class App extends React.Component { "app.forceToLogin": () => { window.app.setLocation("/login") }, - "websocket_connected": () => { + "api.ws.main.connect": () => { if (this.wsReconnecting) { this.wsReconnectingTry = 0 this.wsReconnecting = false @@ -204,7 +204,7 @@ class App extends React.Component { }, 500) } }, - "websocket_connection_error": () => { + "api.ws.main.connect_error": () => { if (!this.wsReconnecting) { this.latencyWarning = null this.wsReconnectingTry = 0 @@ -223,27 +223,16 @@ class App extends React.Component { window.location.reload() } }, - "websocket_latency_too_high": () => { - if (!this.latencyWarning) { - this.latencyWarning = true - - Toast.show({ - icon: "loading", - content: "Slow connection...", - duration: 0, - }) - } - }, - "websocket_latency_normal": () => { - if (this.latencyWarning) { - this.latencyWarning = null - - Toast.show({ - icon: "success", - content: "Connection restored", - }) - } - }, + "api.ws.main.disconnect": () => { + antd.notification.open({ + message: + {(t) => t("Disconnected")} + , + description: + {(t) => t("You have been disconnected from the server, trying to reconnect.")} + + }) + } } static staticRenders = {