From f1bf70624288bd192b9523764f239eee2a022304 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 3 Feb 2016 15:07:03 -0800 Subject: PLT-1851 reconnect and get missing messages --- web/react/stores/socket_store.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'web') diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx index 744c2c8e5..8f24f02a6 100644 --- a/web/react/stores/socket_store.jsx +++ b/web/react/stores/socket_store.jsx @@ -64,6 +64,8 @@ class SocketStoreClass extends EventEmitter { ErrorStore.storeLastError(null); ErrorStore.emitChange(); } + + AsyncClient.getChannels(); } this.failCount = 0; @@ -81,7 +83,8 @@ class SocketStoreClass extends EventEmitter { conn.onerror = (evt) => { if (this.failCount === 0) { - console.log('websocket error ' + evt); //eslint-disable-line no-console + console.log('websocket error'); //eslint-disable-line no-console + console.log(evt); //eslint-disable-line no-console } this.failCount = this.failCount + 1; -- cgit v1.2.3-1-g7c22 From c3ab4872a48183d1414a94ac4dade7ed4fc08115 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Thu, 4 Feb 2016 12:07:55 -0800 Subject: PLT-1851 fixing websocket reconnect error --- web/react/stores/socket_store.jsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'web') diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx index 8f24f02a6..96f460e1c 100644 --- a/web/react/stores/socket_store.jsx +++ b/web/react/stores/socket_store.jsx @@ -66,6 +66,7 @@ class SocketStoreClass extends EventEmitter { } AsyncClient.getChannels(); + AsyncClient.getPosts(ChannelStore.getCurrentId()); } this.failCount = 0; @@ -73,6 +74,16 @@ class SocketStoreClass extends EventEmitter { conn.onclose = () => { conn = null; + + if (this.failCount === 0) { + console.log('websocket closed'); //eslint-disable-line no-console + } + + this.failCount = this.failCount + 1; + + ErrorStore.storeLastError({connErrorCount: this.failCount, message: this.translations.socketError}); + ErrorStore.emitChange(); + setTimeout( () => { this.initialize(); @@ -82,15 +93,10 @@ class SocketStoreClass extends EventEmitter { }; conn.onerror = (evt) => { - if (this.failCount === 0) { + if (this.failCount <= 1) { console.log('websocket error'); //eslint-disable-line no-console console.log(evt); //eslint-disable-line no-console } - - this.failCount = this.failCount + 1; - - ErrorStore.storeLastError({connErrorCount: this.failCount, message: this.translations.socketError}); - ErrorStore.emitChange(); }; conn.onmessage = (evt) => { -- cgit v1.2.3-1-g7c22