diff options
author | Corey Hulen <corey@hulen.com> | 2016-04-26 05:41:20 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-04-26 08:41:20 -0400 |
commit | 1ac649c4d5c91106799d69e653bf4bf7e4fcf376 (patch) | |
tree | 84ad4137fc731f3e48618a6645990ad55a99f215 /webapp | |
parent | c2fc28aa1007ff3f7b055fc54bbc058560e50ee1 (diff) | |
download | chat-1ac649c4d5c91106799d69e653bf4bf7e4fcf376.tar.gz chat-1ac649c4d5c91106799d69e653bf4bf7e4fcf376.tar.bz2 chat-1ac649c4d5c91106799d69e653bf4bf7e4fcf376.zip |
PLT-2675 fixing blue bar on logout and re-login (#2798)
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/action_creators/websocket_actions.jsx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/webapp/action_creators/websocket_actions.jsx b/webapp/action_creators/websocket_actions.jsx index c4e9c63c2..a1368ac99 100644 --- a/webapp/action_creators/websocket_actions.jsx +++ b/webapp/action_creators/websocket_actions.jsx @@ -66,6 +66,10 @@ export function initialize() { console.log('websocket closed'); //eslint-disable-line no-console } + if (manuallyClosed) { + return; + } + connectFailCount = connectFailCount + 1; if (connectFailCount > MAX_WEBSOCKET_FAILS) { @@ -75,14 +79,12 @@ export function initialize() { ErrorStore.setConnectionErrorCount(connectFailCount); ErrorStore.emitChange(); - if (!manuallyClosed) { - setTimeout( - () => { - initialize(); - }, - WEBSOCKET_RETRY_TIME - ); - } + setTimeout( + () => { + initialize(); + }, + WEBSOCKET_RETRY_TIME + ); }; conn.onerror = (evt) => { @@ -161,6 +163,7 @@ export function sendMessage(msg) { export function close() { manuallyClosed = true; + connectFailCount = 0; if (conn && conn.readyState === WebSocket.OPEN) { conn.close(); } |