Skip to content

Commit

Permalink
Gracefully handle WAMP disconnects
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Feb 15, 2016
1 parent bc6e8b5 commit e076890
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions htdocs/frontend/javascripts/init.js
Expand Up @@ -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
Expand All @@ -161,6 +162,9 @@ $(document).ready(function() {
entity.subscribe(session);
}
}, true);
}, function(code, reason) {
console.log("Autobahn disconnected (" + code + ", " + reason + ")");
delete middleware.session;
});
});
});
Expand Down

0 comments on commit e076890

Please sign in to comment.