summaryrefslogtreecommitdiff
path: root/javascripts
diff options
context:
space:
mode:
authorJohn Tajima <john@shopify.com>2013-08-30 16:53:59 +0000
committerJohn Tajima <john@shopify.com>2013-08-30 17:00:12 +0000
commite11d3c270c297ba6de2fbc685c74bd67455c83fb (patch)
tree27a565edf48b680d22096e7bbfca18e98c48a436 /javascripts
parent69afd2f27333e9d9ecd4277d0e6459b82fe7c673 (diff)
Fixes event connection close error never re-establishes connection.
Fix EventListener connection close check. console log the event on error and connection. Reload current page on connection close error event.
Diffstat (limited to 'javascripts')
-rw-r--r--javascripts/dashing.coffee9
1 files changed, 6 insertions, 3 deletions
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee
index ee4b6d4..235a965 100644
--- a/javascripts/dashing.coffee
+++ b/javascripts/dashing.coffee
@@ -94,12 +94,15 @@ Dashing.debugMode = false
source = new EventSource('events')
source.addEventListener 'open', (e) ->
- console.log("Connection opened")
+ console.log("Connection opened", e)
source.addEventListener 'error', (e)->
- console.log("Connection error")
- if (e.readyState == EventSource.CLOSED)
+ console.log("Connection error", e)
+ if (e.currentTarget.readyState == EventSource.CLOSED)
console.log("Connection closed")
+ setTimeout (->
+ window.location.reload()
+ ), 10000
source.addEventListener 'message', (e) ->
data = JSON.parse(e.data)