poke
0
Q:

deal with Websocket timeout

let timerID = 0; 
function keepAlive() { 
    let timeout = 15000;  
    if (webSocket.readyState == webSocket.OPEN) {  
        webSocket.send('');  
    }  
    timerId = setTimeout(keepAlive, timeout);  
}  
function cancelKeepAlive() {  
    if (timerId) {  
        cancelTimeout(timerId);  
    }  
}
0

New to Communities?

Join the community