Skip to content
This repository was archived by the owner on Mar 7, 2018. It is now read-only.

Commit 2671d38

Browse files
committed
Merge pull request #211 from redronin/fix-connection-closed
Fixes event connection close error never re-establishes connection.
2 parents 833d995 + 7b4cc3e commit 2671d38

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

javascripts/dashing.coffee

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,15 @@ Dashing.debugMode = false
9494

9595
source = new EventSource('events')
9696
source.addEventListener 'open', (e) ->
97-
console.log("Connection opened")
97+
console.log("Connection opened", e)
9898

9999
source.addEventListener 'error', (e)->
100-
console.log("Connection error")
101-
if (e.readyState == EventSource.CLOSED)
100+
console.log("Connection error", e)
101+
if (e.currentTarget.readyState == EventSource.CLOSED)
102102
console.log("Connection closed")
103+
setTimeout (->
104+
window.location.reload()
105+
), 5*60*1000
103106

104107
source.addEventListener 'message', (e) ->
105108
data = JSON.parse(e.data)

0 commit comments

Comments
 (0)