Skip to content

Commit

Permalink
Merge pull request #4 from Alethio/beta
Browse files Browse the repository at this point in the history
Fixed websocket reconnection bug with the ethstats network server
  • Loading branch information
baxy authored Jan 18, 2019
2 parents 724c5c7 + 7d0e463 commit ce329ab
Show file tree
Hide file tree
Showing 4 changed files with 473 additions and 100 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.4.13] - 2019-01-19
- Fixed websocket bug when reconnecting to the ethstats network server

## [2.4.12] - 2019-01-15
- Added CircleCI workflow to trigger docker hub build sequentially
- Updated Dockerfile to use node:alpine for smaller image size
Expand Down Expand Up @@ -60,7 +63,7 @@ All notable changes to this project will be documented in this file.
- Fixed bug when ensuring the app is running only one instance inside docker container.

## [2.3.8] - 2018-06-07
- Added dbeug infos
- Added debug infos

## [2.3.7] - 2018-06-07
- Ensure the app is running only one instance.
Expand Down
10 changes: 10 additions & 0 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export default class Server {
this.socketIsOpen = true;
this.log.echo(`Connection established with ethstats server "${this.url}"`);

if (this.isLoggedIn) {
this.isLoggedIn = false;
}

if (this.configToSave && !this.lodash.isEqual(this.configToSave, this.config.configStore.get('server'))) {
this.config.configStore.set('server', this.configToSave);
}
Expand Down Expand Up @@ -141,6 +145,12 @@ export default class Server {
this.log.warning(`Connection closed with ethstats server`);
});

this.socket.on('end', () => {
this.isLoggedIn = false;
this.socketIsOpen = false;
this.log.warning(`Connection ended with ethstats server`);
});

this.socket.on('reconnect failed', () => {
this.log.error(`Reconnect to ethstats server failed! Maximum attempts reached. Please try again later or contact ethstats support.`, false, true);
});
Expand Down
Loading

0 comments on commit ce329ab

Please sign in to comment.