forked from extern/egroupware
new method egw.pushAvailable() : bool to check availability of push-server on client-side
This commit is contained in:
parent
1da0af4d2c
commit
5302675aac
@ -93,6 +93,12 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const min_reconnect_time = 1000;
|
||||||
|
const max_reconnect_time = 300000;
|
||||||
|
const check_interval = 30000; // 30 sec
|
||||||
|
const max_ping_response_time = 1000;
|
||||||
|
let reconnect_time = min_reconnect_time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open websocket to push server (and keeps it open)
|
* Open websocket to push server (and keeps it open)
|
||||||
*
|
*
|
||||||
@ -104,11 +110,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
*/
|
*/
|
||||||
json_request.prototype.openWebSocket = function(url, tokens, account_id, error, reconnect)
|
json_request.prototype.openWebSocket = function(url, tokens, account_id, error, reconnect)
|
||||||
{
|
{
|
||||||
const min_reconnect_time = 1000;
|
reconnect_time = reconnect || min_reconnect_time;
|
||||||
const max_reconnect_time = 300000;
|
|
||||||
const check_interval = 30000; // 30 sec
|
|
||||||
const max_ping_response_time = 1000;
|
|
||||||
let reconnect_time = reconnect || min_reconnect_time;
|
|
||||||
let check_timer;
|
let check_timer;
|
||||||
let check = function()
|
let check = function()
|
||||||
{
|
{
|
||||||
@ -429,7 +431,17 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var json = {
|
var json =
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Check if there is a *working* connection to a push server
|
||||||
|
*
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
pushAvailable: function()
|
||||||
|
{
|
||||||
|
return reconnect_time === min_reconnect_time;
|
||||||
|
},
|
||||||
|
|
||||||
/** The constructor of the egw_json_request class.
|
/** The constructor of the egw_json_request class.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user