mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 19:14:16 +00:00
handle ws connections status message
This commit is contained in:
parent
d2a0fd8dcd
commit
b109aa1c8a
@ -189,7 +189,7 @@ class App extends React.Component {
|
|||||||
"app.forceToLogin": () => {
|
"app.forceToLogin": () => {
|
||||||
window.app.setLocation("/login")
|
window.app.setLocation("/login")
|
||||||
},
|
},
|
||||||
"websocket_connected": () => {
|
"api.ws.main.connect": () => {
|
||||||
if (this.wsReconnecting) {
|
if (this.wsReconnecting) {
|
||||||
this.wsReconnectingTry = 0
|
this.wsReconnectingTry = 0
|
||||||
this.wsReconnecting = false
|
this.wsReconnecting = false
|
||||||
@ -204,7 +204,7 @@ class App extends React.Component {
|
|||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"websocket_connection_error": () => {
|
"api.ws.main.connect_error": () => {
|
||||||
if (!this.wsReconnecting) {
|
if (!this.wsReconnecting) {
|
||||||
this.latencyWarning = null
|
this.latencyWarning = null
|
||||||
this.wsReconnectingTry = 0
|
this.wsReconnectingTry = 0
|
||||||
@ -223,27 +223,16 @@ class App extends React.Component {
|
|||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"websocket_latency_too_high": () => {
|
"api.ws.main.disconnect": () => {
|
||||||
if (!this.latencyWarning) {
|
antd.notification.open({
|
||||||
this.latencyWarning = true
|
message: <Translation>
|
||||||
|
{(t) => t("Disconnected")}
|
||||||
Toast.show({
|
</Translation>,
|
||||||
icon: "loading",
|
description: <Translation>
|
||||||
content: "Slow connection...",
|
{(t) => t("You have been disconnected from the server, trying to reconnect.")}
|
||||||
duration: 0,
|
</Translation>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"websocket_latency_normal": () => {
|
|
||||||
if (this.latencyWarning) {
|
|
||||||
this.latencyWarning = null
|
|
||||||
|
|
||||||
Toast.show({
|
|
||||||
icon: "success",
|
|
||||||
content: "Connection restored",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static staticRenders = {
|
static staticRenders = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user