diff options
author | David Underwood <davefp@gmail.com> | 2013-09-03 13:14:20 -0700 |
---|---|---|
committer | David Underwood <davefp@gmail.com> | 2013-09-03 13:14:20 -0700 |
commit | 2671d387e3c9b845431d41ab93d51cf2bd7b2cf8 (patch) | |
tree | 567f10335c4a47abb190c923e05a01496abbaace /javascripts/dashing.coffee | |
parent | 833d995ececc2b26ae791535774f383a1daa9da8 (diff) | |
parent | 7b4cc3e123eefc82674ff7ea68d127dc5a84779e (diff) |
Merge pull request #211 from redronin/fix-connection-closed
Fixes event connection close error never re-establishes connection.
Diffstat (limited to 'javascripts/dashing.coffee')
-rw-r--r-- | javascripts/dashing.coffee | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee index ee4b6d4..fa677e8 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() + ), 5*60*1000 source.addEventListener 'message', (e) -> data = JSON.parse(e.data) |