From a49ce938ea5a39765d906fb387691454ae21def9 Mon Sep 17 00:00:00 2001 From: David Cormier Date: Sun, 9 Feb 2014 12:11:26 -0500 Subject: [PATCH] Add comments to websocket handlers --- js/glowingbear.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 4b2c764..2ee76c0 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -296,23 +296,28 @@ weechat.factory('connection', }; - var onclose = function () { + /* + * Handles websocket disconnection + */ $log.info("Disconnected from relay"); - $rootScope.connected = false; + failCallbacks('disconnection'); + $rootScope.connected = false; $rootScope.$apply(); }; var onerror = function (evt) { - // on error it means the connection problem - // come from the relay not from the password. + /* + * Handles cases when connection issues come from + * the relay. + */ + $log.error("Relay error" + evt.data); if (evt.type === "error" && this.readyState !== 1) { failCallbacks('error'); $rootScope.errorMessage = true; } - $log.error("Relay error " + evt.data); }; protocol.setId = function(id, message) {