diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-03-14 07:17:31 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-03-14 07:17:31 -0400 |
commit | bf7ae0711743926cfbb031675cc3320d7a942465 (patch) | |
tree | 44ad955ae2dba1991c8b7b7986d90c1a79cdfb65 /web/react/stores | |
parent | 975159b52ac6bf0ee6b2d5b73d2391b2e0c6e165 (diff) | |
parent | 72ed22d7421f50bc686e5adaea2f4a416fcbad27 (diff) | |
download | chat-bf7ae0711743926cfbb031675cc3320d7a942465.tar.gz chat-bf7ae0711743926cfbb031675cc3320d7a942465.tar.bz2 chat-bf7ae0711743926cfbb031675cc3320d7a942465.zip |
Merge branch 'release-2.1'
Diffstat (limited to 'web/react/stores')
-rw-r--r-- | web/react/stores/socket_store.jsx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx index ad24a04cd..181de53d7 100644 --- a/web/react/stores/socket_store.jsx +++ b/web/react/stores/socket_store.jsx @@ -31,6 +31,7 @@ class SocketStoreClass extends EventEmitter { this.close = this.close.bind(this); this.failCount = 0; + this.isInitialize = false; this.translations = this.getDefaultTranslations(); @@ -54,24 +55,23 @@ class SocketStoreClass extends EventEmitter { if (this.failCount === 0) { console.log('websocket connecting to ' + connUrl); //eslint-disable-line no-console - if (ErrorStore.getConnectionErrorCount() > 0) { - ErrorStore.setConnectionErrorCount(0); - ErrorStore.emitChange(); - } } + conn = new WebSocket(connUrl); conn.onopen = () => { if (this.failCount > 0) { console.log('websocket re-established connection'); //eslint-disable-line no-console + AsyncClient.getChannels(); + AsyncClient.getPosts(ChannelStore.getCurrentId()); + } + if (this.isInitialize) { ErrorStore.clearLastError(); ErrorStore.emitChange(); - - AsyncClient.getChannels(); - AsyncClient.getPosts(ChannelStore.getCurrentId()); } + this.isInitialize = true; this.failCount = 0; }; |