summaryrefslogtreecommitdiffstats
path: root/web/react/stores
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-02-04 15:36:35 -0800
committerCorey Hulen <corey@hulen.com>2016-02-04 15:36:35 -0800
commit57bfe3137631fbea271b4015cab778d8a384f275 (patch)
tree56fee1771c080738cb113a8bf7cea0079655ac03 /web/react/stores
parent392b878a108492a56cbc2ed68acc7130cac96c0d (diff)
parentc3ab4872a48183d1414a94ac4dade7ed4fc08115 (diff)
downloadchat-57bfe3137631fbea271b4015cab778d8a384f275.tar.gz
chat-57bfe3137631fbea271b4015cab778d8a384f275.tar.bz2
chat-57bfe3137631fbea271b4015cab778d8a384f275.zip
Merge pull request #2075 from mattermost/PLT-1851
PLT-1851 reconnect and get missing messages
Diffstat (limited to 'web/react/stores')
-rw-r--r--web/react/stores/socket_store.jsx23
1 files changed, 16 insertions, 7 deletions
diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx
index 33604f44b..9c3270f68 100644
--- a/web/react/stores/socket_store.jsx
+++ b/web/react/stores/socket_store.jsx
@@ -64,6 +64,9 @@ class SocketStoreClass extends EventEmitter {
ErrorStore.storeLastError(null);
ErrorStore.emitChange();
}
+
+ AsyncClient.getChannels();
+ AsyncClient.getPosts(ChannelStore.getCurrentId());
}
this.failCount = 0;
@@ -71,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();
@@ -80,14 +93,10 @@ class SocketStoreClass extends EventEmitter {
};
conn.onerror = (evt) => {
- if (this.failCount === 0) {
- console.log('websocket error ' + evt); //eslint-disable-line no-console
+ 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) => {