From ab490074d3267a7fdae7c10c0f8e0cd9ffa4fcb0 Mon Sep 17 00:00:00 2001 From: David Cormier Date: Wed, 2 Oct 2013 19:55:30 -0400 Subject: [PATCH] Add connection error message fixes #3 --- index.html | 3 +++ js/websockets.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/index.html b/index.html index c9ac5d2..bda4b63 100644 --- a/index.html +++ b/index.html @@ -13,6 +13,9 @@
Connection +
+ Oh no! We cannot connect! +
diff --git a/js/websockets.js b/js/websockets.js index 633cd78..91e4ba4 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -330,6 +330,9 @@ weechat.factory('connection', ['$rootScope', '$log', 'handlers', 'colors', funct } websocket.onerror = function (evt) { + if (evt.type == "error" && websocket.readyState == 0) { + $rootScope.errorMessage = true; + } $log.error("Relay error " + evt.data); }