Open jonbhanson opened 2 years ago
Mh! good question!
We have some things internally onConnectionLost
but I'm not sure that we expose it as a hook, it is something that we can take a look at.
Thanks for brink this problem up.
@vincenzopalazzo thanks for your work on this. Looking forward to the update! This feature will be very useful.
Maybe you can reproduce and same me a ton of time with the following API that we are provided?
This is a feature request, not a bug report, so I'm not sure how reproducing applies?
Mh! I was thinking that this feature request was connected to some bugs that we had in the ws.
Looks like that is not the case, and the estimation of this issue is after we complete the refactoring of the ws in the library, so it can take a while
Any updates on this? 🙏 Looking forward to this feature!
I have an issue with the same thing. You cannot present an decent error message to enduser. In Tibbers GraphQL API when no subscription was found, the websocket are disconnected with "There was an error causing connection lost: Bad state: No element" all the time.
I would suggest that an exception was thrown in the listen-loop, like here:
SubscriptionOptions so =
SubscriptionOptions(document: getSubscriptionDocument(selHomeId), errorPolicy: ErrorPolicy.all);
var sub = client.subscribe(so);
sub.listen((result) {
if (result.hasException) { //Throw exception connectionLost here
debugPrint("Exception ${result.exception.toString()}");
return;
}
//(....)
+1
Hi, thanks for a great package!
Is there a way to detect when a subscription is lost? For example, if the app is backgrounded for some period of time, subscriptions lose their connection to the GraphQL server. If events come in after the connection is lost, the client misses those events. When the client comes back into focus, the data is not fresh. I would like to receive a notification from the package that the subscription went down so that I can fetch data from the server to ensure that it is fresh. Is there a way to do this?
Thanks again and keep up the great work!