From 1dd2c4ce7baeca0f3aeb2508379feedc5af10db5 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 16 Apr 2019 13:01:47 +0200 Subject: [PATCH] Reconnect if we can't send a message due to dropped connection --- dist/converse.js | 7 ++++++- src/converse-chatview.js | 3 +++ src/headless/converse-core.js | 2 +- src/headless/dist/converse-headless.js | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dist/converse.js b/dist/converse.js index 039fb0638..fcd213bcc 100644 --- a/dist/converse.js +++ b/dist/converse.js @@ -49781,6 +49781,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins if (!_converse.connection.authenticated) { this.showHelpMessages(['Sorry, the connection has been lost, and your message could not be sent'], 'error'); + + if (!_converse.connection.reconnecting) { + _converse.reconnect(); + } + return; } @@ -63848,7 +63853,7 @@ _converse.initialize = async function (settings, callback) { _converse.tearDown(); _converse.logIn(null, true); - }, 3000, { + }, 2000, { 'leading': true }); diff --git a/src/converse-chatview.js b/src/converse-chatview.js index 1b52c1a35..4694dc2d5 100644 --- a/src/converse-chatview.js +++ b/src/converse-chatview.js @@ -922,6 +922,9 @@ converse.plugins.add('converse-chatview', { ['Sorry, the connection has been lost, and your message could not be sent'], 'error' ); + if (!_converse.connection.reconnecting) { + _converse.reconnect(); + } return; } let spoiler_hint, hint_el = {}; diff --git a/src/headless/converse-core.js b/src/headless/converse-core.js index cbadf2b19..4b159981d 100644 --- a/src/headless/converse-core.js +++ b/src/headless/converse-core.js @@ -691,7 +691,7 @@ _converse.initialize = async function (settings, callback) { _converse.connection.reconnecting = true; _converse.tearDown(); _converse.logIn(null, true); - }, 3000, {'leading': true}); + }, 2000, {'leading': true}); this.disconnect = function () { _converse.log('DISCONNECTED'); diff --git a/src/headless/dist/converse-headless.js b/src/headless/dist/converse-headless.js index 77e513fdc..2d5e0ad82 100644 --- a/src/headless/dist/converse-headless.js +++ b/src/headless/dist/converse-headless.js @@ -42361,7 +42361,7 @@ _converse.initialize = async function (settings, callback) { _converse.tearDown(); _converse.logIn(null, true); - }, 3000, { + }, 2000, { 'leading': true });