var ws = new WebSocket(url);
var timeout = setTimeout(function(){
// Testing if it worked.
}, 30000);
ws.onmessage = function(){
clearTimeout(timeout);
};
This scenario happens with some socket.io logout libraries. The web socket message doesn't happen within a Zone, so the clearTimeout call doesn't cause the setTimeout's task to complete.
The fix is to make sure that websocket messages are wrapped within a Zone.
Consider this code:
This scenario happens with some socket.io logout libraries. The web socket message doesn't happen within a Zone, so the
clearTimeout
call doesn't cause the setTimeout's task to complete.The fix is to make sure that websocket messages are wrapped within a Zone.