-
Notifications
You must be signed in to change notification settings - Fork 796
Conversation
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.
can we not make the reconnect logic always trigger after constructing the websocket?
I think this should be configurable because you might want to set something like: how many reconnects, perhaps alternative endpoint but maybe we should configure reconnect as default |
what should we do here? |
sorry forgot about this. was kinda hoping someone else would pick this up. should we keep this open so someone can take over/use this as inspiration? I feel like this is not a high priority at this time. |
OK closing then and let's have someone else pick it up if they feel like it. |
Hi guys, How about propagating the Ws handle at the application layer? We could make it accessible from the |
I think it's safe to assume that all ethers users want automatic reconnection (without an explicit instruction from the user to disconnect) |
You are right, but maybe the solution lies in the middle. A retry mechanism could be implemented at the transport layer; whenever the situation becomes unrecoverable, the application should take control and issue specific actions. |
fwiw i (ethers user) don't want automatic reconnect. reconnect may take a long time/fail and its possible endpoint may be misbehaving in other ways, i would prefer to handle errors myself and restart relevant parts of my app from known-good state |
Picking this up |
Opened #1915 |
Motivation
provide a way to retrieve the spawned
WsServer
on errorSolution
Add
WsServerHandle
type that wraps theJoinHandle
for the spawnedWsServer
.WsServer
-> into_future -> WsServerFuture -> spawn ->WsServerHandle
-> await -> Err(WsServer)the
WsServerFuture::Output
will beWsServer
in the error caseI don't think there's an easy way to make this work in wasm since the future would need to return JsValue for it to be wrapped in a promise, so I think it's fine to exclude this for wasm
todo
the output type of the handle is a bit verbose but could be used like
cc @prestwich
PR Checklist