From e076890a5f14e3a4a993e07d49dbd61b0ead1ed0 Mon Sep 17 00:00:00 2001 From: andig Date: Mon, 15 Feb 2016 11:44:44 +0100 Subject: [PATCH] Gracefully handle WAMP disconnects --- htdocs/frontend/javascripts/init.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/frontend/javascripts/init.js b/htdocs/frontend/javascripts/init.js index 08038a011..66d8099a9 100644 --- a/htdocs/frontend/javascripts/init.js +++ b/htdocs/frontend/javascripts/init.js @@ -153,6 +153,7 @@ $(document).ready(function() { // connect and store session new ab.connect(uri, function(session) { + console.log("Autobahn connected to " + uri + " (" + session.sessionid() + ")"); middleware.session = session; // subscribe entities @@ -161,6 +162,9 @@ $(document).ready(function() { entity.subscribe(session); } }, true); + }, function(code, reason) { + console.log("Autobahn disconnected (" + code + ", " + reason + ")"); + delete middleware.session; }); }); });