Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3214 Widoki

Hello Everyone, 

I used yeastar Api to receive all calls in odoo without using odoo VOIP, yeaster Api.


using JS code i trying to make refresh access token every 1800 seconds and refresh every 60 seconds, i used setInterval function by this simple idea to refresh Access Token:

var refresh_access_token = setInterval(function(){ ajax.rpc('get_access_token').then(
function(data){ // data returned from python function..
access_token = data.access_token; // access token returned from py function
interval_time = data.interval_time; // remaining time to refresh access token
}); } , interval_time);

but this idea not work because interval time must be static i think !.  


and for Web Socket i used:

const socket = new WebSocket('wss://some.some.com/openapi/v1.0/subscribe?access_token=' + access_token );
var te=setInterval(function(){
socket.addEventListener('open', (event) => {
socket.send('{"topic_list":[30011,30012]}');
});

console.log("hello from inteval")
},50000);




So gays i need good idea to refresh access token every 1800 seconds, and make wws stable.


Thanks all, 

 


 


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lis 22
2295
2
lip 23
6004
2
sie 22
3095
1
cze 22
4729
1
sie 23
1728