-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use ReconnectingSocket in Tendermint and Ethereum #1093
Conversation
I think calling
should be valid, especially since it is hard for an application to know when the connection was established. I think There is a test |
4860e31
to
01536c8
Compare
c5f9d15
to
ff9a00d
Compare
d0309f0
to
6b88f4b
Compare
|
||
return response; | ||
} | ||
|
||
public async socketSend(request: JsonRpcRequest, ignoreNetworkError: boolean = false): Promise<void> { | ||
await this.socket.connected; | ||
public async socketSend(request: JsonRpcRequest, ignoreNetworkError: boolean | undefined): Promise<void> { |
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.
Why this signature change? This requires the caller to set ignoreNetworkError
to something. If we want that, we can remove the undefined
option.
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.
Whoops, originally removed the parameter entirely then added it back in with the compiler's suggestion.
@@ -200,7 +195,15 @@ export class WebsocketClient implements RpcStreamingClient { | |||
* so this should be required for testing purposes only. | |||
*/ | |||
public async connected(): Promise<void> { | |||
return this.socket.connected; | |||
return new Promise(resolve => { |
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.
await this.socket.connectionStatus.waitFor(ConnectionStatus.Connected)
This does what you implement below and also resolves when the value is ConnectionStatus.Connected
already.
6b88f4b
to
874829a
Compare
Closes #229
Opening a draft PR to discuss API. In particular, the
EthereumConnection
tests callsocket.disconnect()
but currently if you do this onReconnectingSocket
before the connection has been successfully established you get an error. Should this be changed or should the higher-level WS clients expose a stream of connection statuses?