summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-02-04 12:07:55 -0800
committer=Corey Hulen <corey@hulen.com>2016-02-04 12:07:55 -0800
commitc3ab4872a48183d1414a94ac4dade7ed4fc08115 (patch)
treeef639e620d7b1888c2537b18fc83d7e085425b73 /web
parentcfd4e4de963703191e750ba0abb901c5f6c0c3e4 (diff)
downloadchat-c3ab4872a48183d1414a94ac4dade7ed4fc08115.tar.gz
chat-c3ab4872a48183d1414a94ac4dade7ed4fc08115.tar.bz2
chat-c3ab4872a48183d1414a94ac4dade7ed4fc08115.zip
PLT-1851 fixing websocket reconnect error
Diffstat (limited to 'web')
-rw-r--r--web/react/stores/socket_store.jsx18
1 files changed, 12 insertions, 6 deletions
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) => {