keepAlive timeout is calculated based on session timeout defined in service configuration and is returned in the init response.
context.sessionID =
data.getElementsByTagName("session")[0]
.childNodes[0].nodeValue;
+ if (data.getElementsByTagName("keepAlive").length > 0) {
+ context.keepAlive = data.getElementsByTagName("keepAlive")[0].childNodes[0].nodeValue;
+ }
context.pingTimer =
setTimeout(
function () {
wrbuf_puts(c->wrbuf, "</session>"
"<protocol>" PAZPAR2_PROTOCOL_VERSION "</protocol>");
+ wrbuf_printf(c->wrbuf, "<keepAlive>%d</keepAlive>\n", 1000 * ((s->psession->service->session_timeout >= 20) ?
+ (s->psession->service->session_timeout - 10) : 50));
response_close(c, "init");
}