diff options
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/stores/socket_store.jsx | 23 |
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) => { |