gql
gql copied to clipboard
[gql_web_socket_link] Ability to stop and resume all subscriptions
Hi. gql_web_socket_link has autoreconnect functionality which reruns all subscriptions from _requests list in order to resubscribe.
I'm playing around with subs functionality and wondering if it is possible to unsubscribe on app lifecycle stream. Technically there is no need to receive data from server if the app in paused state.
It would be great to have some stream param which can work like toggle to unsubscribe all when user pauses the app and resubscribe on getting back to the app.
Sounds like a valid use case! It's not a high priority for me right now, but I will accept PRs.
I have to admit that the gql_websocket_link generally is not in a good state right now as it does not support the recommended subprotocol, graphql-ws.
If someone wants to work on that, maybe consider basing it on an implementation that supports the new protocol, like the one in graphql: https://github.com/zino-hofmann/graphql-flutter/tree/main/packages/graphql/lib/src/links/websocket_link
Just got here because of this error WebSocketChannelException: WebSocketChannelException: SocketException: Software caused connection abort (OS Error: Software caused connection abort, errno = 103), address = domain.com, port = 39608
and
SocketException: Software caused connection abort (OS Error: Software caused connection abort, errno = 103), address = domain.com, port = 39608
dont really know how to fix it.