mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-18 04:20:05 +02:00
move who is available via push to push class and backends
This commit is contained in:
@@ -415,7 +415,8 @@
|
||||
{
|
||||
egw.json('websocket', {}, undefined, this).openWebSocket(
|
||||
egw_script.getAttribute('data-websocket-url'),
|
||||
JSON.parse(egw_script.getAttribute('data-websocket-tokens'))
|
||||
JSON.parse(egw_script.getAttribute('data-websocket-tokens')),
|
||||
parseInt(egw_script.getAttribute('data-websocket-account_id'))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
5
api/js/jsapi/egw_global.d.ts
vendored
5
api/js/jsapi/egw_global.d.ts
vendored
@@ -685,11 +685,12 @@ declare class JsonRequest
|
||||
* Open websocket to push server (and keeps it open)
|
||||
*
|
||||
* @param {string} url this.websocket(s)://host:port
|
||||
* @param {array} tokens tokens to subscribe too
|
||||
* @param {array} tokens tokens to subscribe too: sesssion-, user- and instance-token (in that order!)
|
||||
* @param {number} account_id to connect for
|
||||
* @param {function} error option error callback(_msg) used instead our default this.error
|
||||
* @param {int} reconnect timeout in ms (internal)
|
||||
*/
|
||||
openWebSocket(url : string, tokens : string[], error : Function, reconnect : number);
|
||||
openWebSocket(url : string, tokens : string[], account_id : number, error : Function, reconnect : number);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -98,11 +98,12 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
* Open websocket to push server (and keeps it open)
|
||||
*
|
||||
* @param {string} url this.websocket(s)://host:port
|
||||
* @param {array} tokens tokens to subscribe too
|
||||
* @param {array} tokens tokens to subscribe too: sesssion-, user- and instance-token (in that order!)
|
||||
* @param {number} account_id to connect for
|
||||
* @param {function} error option error callback(_msg) used instead our default this.error
|
||||
* @param {int} reconnect timeout in ms (internal)
|
||||
*/
|
||||
json_request.prototype.openWebSocket = function(url, tokens, error, reconnect)
|
||||
json_request.prototype.openWebSocket = function(url, tokens, account_id, error, reconnect)
|
||||
{
|
||||
const min_reconnect_time = 1000;
|
||||
const max_reconnect_time = 300000;
|
||||
@@ -113,7 +114,8 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
{
|
||||
reconnect_time = min_reconnect_time;
|
||||
this.websocket.send(JSON.stringify({
|
||||
subscribe: tokens
|
||||
subscribe: tokens,
|
||||
account_id: parseInt(account_id)
|
||||
}));
|
||||
}, this);
|
||||
|
||||
@@ -147,7 +149,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
// e.g. server process killed or network down
|
||||
// event.code is usually 1006 in this case
|
||||
console.log('[close] Connection died --> reconnect in '+reconnect_time+'ms');
|
||||
window.setTimeout(jQuery.proxy(this.openWebSocket, this, url, tokens, error, reconnect_time), reconnect_time);
|
||||
window.setTimeout(jQuery.proxy(this.openWebSocket, this, url, tokens, account_id, error, reconnect_time), reconnect_time);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
Reference in New Issue
Block a user