-
Notifications
You must be signed in to change notification settings - Fork 262
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
Is it possible to handle reconnecting internally? #551
Comments
The complexity with this is that if the connection is lost, any subscriptions and so on will go away, including things like watching for transaction status when submitting an extrinsic. having your own connection logic allows you to decide what to do about those things (resubscribing to anything of interest and taking into account the potential for missed information, and deciding what to do about transactions you are no longer able to monitor, for instance). It's the sort of feature I'd like to have in subxt, but it could be quite tricky to implement, and things like waiting for extrinsics to finalize would potentially just never complete and there is afaik no good way to deal with that at the moment. Any ideas or thoughts would be welcome! |
Maybe consider some behaviors to align with |
For subscriptions you could just send an event indicating that the subscription had stopped and one would need to resubscribe. Then later if you add re-subscribing logic you could do that in the back and not send the event. It would be helpfult to be able to opt into having something that re-established a connection. (Or provide a reconnecting wrapper type?). That at least would work for people not using the subscriptions and using it more like a rust API to substrate. |
Thanks, definitely something to think about! I haven't forgotten about this issue; just been busy on other bits of late :) |
I am working on this to implement retry for ws clients https://github.com/AcalaNetwork/subway/blob/master/src/client/mod.rs |
This has been fixed, subxt provides a reconnecting-rpc-client behind a feature flag but everything works as intended we will make it the default one in a future release. |
It's not easy to reconnect if not wrap so many code by myself.
Maybe It's good idea to try to reconnect just like polkadotjs/api
The text was updated successfully, but these errors were encountered: