Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

A method that would expose a native WebSocket Object. #1648

Open
dawid-niedzwiecki opened this issue Sep 21, 2021 · 4 comments
Open

A method that would expose a native WebSocket Object. #1648

dawid-niedzwiecki opened this issue Sep 21, 2021 · 4 comments
Labels
api / realtime Fixes and upgrades for the Appwrite Realtime API. enhancement New feature or request

Comments

@dawid-niedzwiecki
Copy link

🚀 Feature

It would be great to be able to check if the connection with the websocket (Realtime) is open on android/flutter. A method, that would expose the a WebSocket Object would allow that.

Have you spent some time to check if this issue has been raised before?

I've been told by @TorstenDittmann to raise this issue.

Have you read the Code of Conduct?

I did :)

Pitch

Well, Android sometimes closes the websocket connection when the screen is turned off. An easy way to re-connect with the Realtime service, would be to make use of Flutters AppLifecycleState. One could listen for the AppLifecycleState.resumed and reconnect.

@TorstenDittmann TorstenDittmann added the enhancement New feature or request label Sep 21, 2021
@eldadfux eldadfux added the api / realtime Fixes and upgrades for the Appwrite Realtime API. label Dec 21, 2021
@TorstenDittmann
Copy link
Contributor

@lohanidamodar will exposing the WebSocket instance be a problem for Flutter?

@lohanidamodar
Copy link
Member

@TorstenDittmann Apart from Flutter web, I should be able to expose web socket if needed. However, if I do expose, and someone closes web socket from outside, SDK will cause bunch of unintended memory links as there would be streams, and channels not properly closed. May be we should just expose whether or not the connection is alive?

@outrelouxhe
Copy link

I like the idea of @lohanidamodar to just expose the connection alive status. In Flutter, when the apps resume from background, we don't have any way to check if the realtime connection is still alive... So right now I need to close it and reopen it, but it leads sometimes to receiving realtime messages multiple times.

@Schrolli91
Copy link

Schrolli91 commented Nov 21, 2023

Any updates on this topic so far?
I also have the problem, that the socket is offline after awake from sleep on Android.
And i have no idea how to detect the broken socket or reconnect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api / realtime Fixes and upgrades for the Appwrite Realtime API. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants