-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nikos/5835/websocket provider keeps important error message back #5884
Nikos/5835/websocket provider keeps important error message back #5884
Conversation
Pull Request Test Coverage Report for Build 4344683272
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also changelog update is required
@@ -207,7 +247,11 @@ WebsocketProvider.prototype._addSocketListeners = function () { | |||
this.connection.addEventListener('message', this._onMessage.bind(this)); | |||
this.connection.addEventListener('open', this._onConnect.bind(this)); | |||
this.connection.addEventListener('close', this._onClose.bind(this)); | |||
}; | |||
if(this.connection._connection){ | |||
this.connection._client.removeAllListeners('connectFailed'); //Override the internal listeners, so they don't trigger a `close` event. We want to trigger `_onClose` manually with a description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As browsers use the native WebSocket object + doesn't use/have ws lib client and node uses ws client. so can we more specifically check _client
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And do we also need to handle the same for the browser WebSocket? Or is it only an issue that we need to handle just for node?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…-error-message-back
Description
closes #5835
Checklist for 1.x:
npm run dtslint
with success and extended the tests and types if necessary.npm run test:cov
and my test cases cover all the lines and branches of the added code.npm run build
with success.dist/web3.min.js
in a browser.CHANGELOG.md
file in the root folder.