Skip to Content
Menu
This question has been flagged
2389 Views

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, 

 


 


Avatar
Discard
Related Posts Replies Views Activity
0
Nov 22
1556
2
Jul 23
4802
2
Aug 22
2165
1
Jun 22
3893
1
Aug 23
977