diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-03-05 14:45:47 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-03-05 14:46:48 +0300 |
commit | 24c9e2b158ff90c2010401542557ffb4793c7aa8 (patch) | |
tree | 29a21ad678acea04ca87b20125acb3deda31ce22 /src/utils/signaling.js | |
parent | de1653461d953e288865baaa92de06f7cc1eb73d (diff) |
Add hint of issue in notification about error connecting to signaling
Several errors in a row in the hello response usually point to a
misconfigured signaling server that can not connect to the Nextcloud
server. The error message now also takes into account the number of
hello response errors in a row and hints at a possible misconfiguration.
As this is a very specific issue the UI does not show any other detail
regarding the received error, and the message is not reverted to the
generic one if the websocket connection fails after the hello response
failed; it is just a hint to make an admin look at the browser console
or the signaling server logs.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src/utils/signaling.js')
-rw-r--r-- | src/utils/signaling.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/utils/signaling.js b/src/utils/signaling.js index 116df644f..14d4e7222 100644 --- a/src/utils/signaling.js +++ b/src/utils/signaling.js @@ -518,6 +518,7 @@ function Standalone(settings, urls) { this.initialReconnectIntervalMs = 1000 this.maxReconnectIntervalMs = 16000 this.reconnectIntervalMs = this.initialReconnectIntervalMs + this.helloResponseErrorCount = 0 this.ownSessionJoined = false this.joinedUsers = {} this.rooms = [] @@ -845,10 +846,22 @@ Signaling.Standalone.prototype.helloResponseReceived = function(data) { return } - if (this.signalingConnectionError === null) { + this.helloResponseErrorCount++ + + if (this.signalingConnectionError === null && this.helloResponseErrorCount < 5) { this.signalingConnectionError = showError(t('spreed', 'Failed to establish signaling connection. Retrying …'), { timeout: TOAST_PERMANENT_TIMEOUT, }) + } else if (this.helloResponseErrorCount === 5) { + // Switch to a different message as several errors in a row in hello + // responses indicate that the signaling server might be unable to + // connect to Nextcloud. + if (this.signalingConnectionError) { + this.signalingConnectionError.hideToast() + } + this.signalingConnectionError = showError(t('spreed', 'Failed to establish signaling connection. Something might be wrong in the signaling server configuration'), { + timeout: TOAST_PERMANENT_TIMEOUT, + }) } // TODO(fancycode): How should this be handled better? @@ -857,6 +870,8 @@ Signaling.Standalone.prototype.helloResponseReceived = function(data) { return } + this.helloResponseErrorCount = 0 + if (this.signalingConnectionError !== null) { this.signalingConnectionError.hideToast() this.signalingConnectionError = null |