From e11d3c270c297ba6de2fbc685c74bd67455c83fb Mon Sep 17 00:00:00 2001 From: John Tajima Date: Fri, 30 Aug 2013 16:53:59 +0000 Subject: 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. --- javascripts/dashing.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'javascripts') 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) -- cgit v1.2.3 From 7b4cc3e123eefc82674ff7ea68d127dc5a84779e Mon Sep 17 00:00:00 2001 From: John Tajima Date: Tue, 3 Sep 2013 13:35:31 +0000 Subject: change reload to 5 minutes --- javascripts/dashing.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'javascripts') diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee index 235a965..fa677e8 100644 --- a/javascripts/dashing.coffee +++ b/javascripts/dashing.coffee @@ -102,7 +102,7 @@ source.addEventListener 'error', (e)-> console.log("Connection closed") setTimeout (-> window.location.reload() - ), 10000 + ), 5*60*1000 source.addEventListener 'message', (e) -> data = JSON.parse(e.data) -- cgit v1.2.3