Created
February 6, 2014 09:08
-
-
Save snowman-repos/8840790 to your computer and use it in GitHub Desktop.
Deal with WebSocket timeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timerID = 0 | |
keepAlive = -> | |
timeout = 15000 | |
webSocket.send "" if webSocket.readyState is webSocket.OPEN | |
timerId = setTimeout(keepAlive, timeout) | |
cancelKeepAlive = -> | |
cancelTimeout timerId if timerId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment