Allowing access to ConnectionState from GraphQLClient for Subscriptions
Is your feature request related to a problem? Please describe. We want to listen to GraphQL's subscriptions for onConnected, onDisconnected to show connection status. But connectionState is deep inside SocketClient class which is not directly exposed.
Describe the solution you'd like If we allow access to the Stream<ConnectionState> then we can listen to it and do client side operations based on connection status (connected/disconnected)
Describe alternatives you've considered None
Additional context None
Just came here looking for the same thing, we have an app where we need to indicate to the user that the data is stale, would be great to have another value within the Subscription widget that contains the connection status.
This is highly needed!
Same here, this would be really helpful. Is it on the roadmap?
Would just exposing client connection state work here?
class WebSocketLink extends Link {
//...
Stream<SocketConnectionState> get connectionState => _socketClient.connectionState;
}
One potential stop-gap for this is doing something like the following on the v4 beta:
SocketClientConfig(
onConnectOrReconnect: (socket) async {
socket.stream.doOnError(...)
},
)