diff --git a/admin/inc/class.admin_hooks.inc.php b/admin/inc/class.admin_hooks.inc.php index 346ce54188..720a04a874 100644 --- a/admin/inc/class.admin_hooks.inc.php +++ b/admin/inc/class.admin_hooks.inc.php @@ -132,6 +132,10 @@ class admin_hooks { $file['phpInfo'] = "javascript:egw.openPopup('" . Egw::link('/admin/phpinfo.php','',false) . "',960,600,'phpinfoWindow')"; } + if (file_exists(EGW_SERVER_ROOT.'/swoolepush/test.php')) + { + $file['Test Push'] = Egw::link('/swoolepush/test.php'); + } $file['Admin queue and history'] = Egw::link('/index.php','menuaction=admin.admin_cmds.index&ajax=true'); $file['Remote administration instances'] = Egw::link('/index.php','menuaction=admin.admin_cmds.remotes&ajax=true'); $file['Custom translation'] = Egw::link('/index.php','menuaction=admin.admin_customtranslation.index'); diff --git a/api/js/jsapi/egw_json.js b/api/js/jsapi/egw_json.js index 5ef159af12..0b44cd2733 100644 --- a/api/js/jsapi/egw_json.js +++ b/api/js/jsapi/egw_json.js @@ -112,7 +112,6 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) this.websocket = new WebSocket(url); this.websocket.onopen = jQuery.proxy(function(e) { - reconnect_time = min_reconnect_time; this.websocket.send(JSON.stringify({ subscribe: tokens, account_id: parseInt(account_id) @@ -121,6 +120,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) this.websocket.onmessage = jQuery.proxy(function(event) { + reconnect_time = min_reconnect_time; console.log(event); let data = JSON.parse(event.data); if (data && data.type) @@ -131,6 +131,9 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) this.websocket.onerror = jQuery.proxy(function(error) { + reconnect_time *= 2; + if (reconnect_time > max_reconnect_time) reconnect_time = max_reconnect_time; + console.log(error); (error||this.handleError({}, error)); }, this); @@ -139,6 +142,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) { if (event.wasClean) { + reconnect_time = min_reconnect_time; console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`); } else diff --git a/api/src/Json/Push.php b/api/src/Json/Push.php index 50b81c2ac8..6d11861d41 100644 --- a/api/src/Json/Push.php +++ b/api/src/Json/Push.php @@ -117,11 +117,12 @@ class Push extends Msg /** * Check and if neccessary set push backend * + * @param boolean $ignore_cache =false * @throws Exception\NotOnline */ - protected static function checkSetBackend() + protected static function checkSetBackend($ignore_cache=false) { - if (!isset(self::$backend)) + if ($ignore_cache || !isset(self::$backend)) { // we prepend so the default backend stays last foreach(Api\Hooks::process('push-backends', [], true) as $class) @@ -156,12 +157,13 @@ class Push extends Msg /** * Check if only fallback / no real push available * + * @param boolean $ignore_cache =false * @return bool true: fallback, false: real push */ - public static function onlyFallback() + public static function onlyFallback($ignore_cache=false) { try { - self::checkSetBackend(); + self::checkSetBackend($ignore_cache); } catch (\Exception $e) { return true;