From 13305e627f9d87951e4fa969ac15d838dcc17edb Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Mon, 23 Oct 2017 17:31:33 +0200 Subject: [PATCH] Added location reload if eventSource loose connection --- static/js/index/index.js | 3 ++- static/js/index/index_map.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/index/index.js b/static/js/index/index.js index 21560b4..ea2f6b4 100644 --- a/static/js/index/index.js +++ b/static/js/index/index.js @@ -114,7 +114,8 @@ $(document).ready(function () { }; source_log.onerror = function(){ - //console.log('error: '+source_log.readyState); + console.log('error: '+source_log.readyState); + setTimeout(function() { location.reload(); }, 5000); }; source_log.onmessage = function(event) { diff --git a/static/js/index/index_map.js b/static/js/index/index_map.js index 5d8e3e1..000350f 100644 --- a/static/js/index/index_map.js +++ b/static/js/index/index_map.js @@ -171,5 +171,6 @@ source_map.onopen = function(){ console.log('connection is opened. '+source_map.readyState); }; source_map.onerror = function(){ - console.log('error: '+source_map.readyState); + console.log('error: '+source_map.readyState); + setTimeout(function() { location.reload(); }, 5000); };