Skip to content

Instantly share code, notes, and snippets.

@snowman-repos
Created February 6, 2014 09:08
Show Gist options
  • Save snowman-repos/8840790 to your computer and use it in GitHub Desktop.
Save snowman-repos/8840790 to your computer and use it in GitHub Desktop.
Deal with WebSocket timeout
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