From 24c9e2b158ff90c2010401542557ffb4793c7aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 5 Mar 2021 12:45:47 +0100 Subject: Add hint of issue in notification about error connecting to signaling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/utils/signaling.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/utils/signaling.js') 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 -- cgit v1.2.3