Skip to content

Instantly share code, notes, and snippets.

@mathieuancelin
Created February 2, 2016 18:26
Show Gist options
  • Save mathieuancelin/44b0eecf95546ff3ac23 to your computer and use it in GitHub Desktop.
Save mathieuancelin/44b0eecf95546ff3ac23 to your computer and use it in GitHub Desktop.
var ws = new WebSocket('...');
var timeout = setTimeout(function() {
console.log('fuuuuuuuu', ws.readyState);
ws.close();
}, monSuperTimeout);
ws.onopen = function(event) {
clearTimeout(timeout);
...
};
ws.onclose = function(event) {
clearTimeout(timeout);
...
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment