polkadart
polkadart copied to clipboard
No reconnect method in WsProvider.
Hello,
How to implement reconnect function with built-in Ws Provider?
As a workaround I created custom Ws Provider that extends Provider, and implement it by myself.
You can pretty much catch the exception and call the connect method again. But I guess what you want is to auto-reconnect, is that correct?
auto reconnect would be a nice feature.
But my main problem with no 'onError' and 'onDone' callbacks. After losing internet connection Websocket connection will be lost as well as all subscriptions and queries. And there's no TimeOutException in websocket by default.
For example: Class provider.dart [line 184 - 186]
}).listen((message) {
queries.remove(message.id)!.complete(message);
});
And [line 203 - 207]
}).listen((message) {
final StreamController? controller =
get SubscriptionController(message.subscription);
controller?.add(message);
});
'jsonStream' only listening for responses and completely ignores any errors.
I see. @Lohann was responsible for this part but not sure if he has free time to look into it. I'm going to check with him and if he is not able to take a look add to my queue here.
Good catch @overetch, will fix this week when I have some free time.
@Lohann were you able to look into this?