Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[gql_web_socket_link] Ability to stop and resume all subscriptions #390

Open
vasilich6107 opened this issue Feb 28, 2023 · 2 comments
Open

Comments

@vasilich6107
Copy link
Contributor

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.

@knaeckeKami
Copy link
Collaborator

knaeckeKami commented Feb 28, 2023

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

@MichalNemec
Copy 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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants