diff --git a/data_providers/avtocod.js b/data_providers/avtocod.js index e580130..d5408ad 100644 --- a/data_providers/avtocod.js +++ b/data_providers/avtocod.js @@ -22,6 +22,10 @@ const sign = { let deviceToken = uuidv4().replaceAll('-', '').toUpperCase(); var cookie = null; +setInterval(() => { + cookie = null; +}, 10*60*60*1000); + const myWs = function (options) { return class wsClass extends WebSocket { constructor(...args) { @@ -140,7 +144,10 @@ function getToken(ctx) { return new Promise((resolve, reject) => { fetch(tokenRefreshUrl, { method: 'POST', - headers: new Headers({ 'Content-Type': 'application/json' }), + headers: new Headers({ + 'Content-Type': 'application/json', + 'cookie': cookie + }), body: JSON.stringify(ctx) }) .then(res => { @@ -184,7 +191,7 @@ function waitForReport(centrifugoConfig, channel) { } else { reject(new Error('Request to avtocod timed out')); } - }, 10000); + }, 15000); const sub = centrifuge.newSubscription(channel);