i used the subscription.close but still socket connection remains open. my aim is to refresh connections if a team is created , user is added to the team and all permission of the document is given to that team. but while creating that document invocation is not sent to that users in the team. (All collection permission is create to all user).
Summary
The user is experiencing an issue where their realtime subscription is not closing properly. They are using the `realtime.subscribe()` method multiple times and calling `subscription.close()` to close the subscription. However, the websocket connection remains open. They have provided code in Flutter and are refreshing the connection every 5 seconds for testing purposes. They are trying to refresh the connection when a team is created and a user is added to the team. However, the invocation is not being sent to the users in the team. The user is looking for assistance in resolving this issue.
joeyouss
Mar 15, 2023, 18:11
Hi, any chance you could show me your code?
Karthik
Rank 2: Process
Mar 15, 2023, 18:48
ok , i have made a test code. which basically refresh connection every 5 seconds . its just for testing purpose. before refreshing previous connection is closed.
code is in flutter, realtime is declaration is outside timer.
Drake
Admin
Mar 15, 2023, 20:29
so you use that realtime instance and call realtime.subscribe() multiple times?
Karthik
Rank 2: Process
Mar 15, 2023, 20:47
yes
Drake
Admin
Mar 15, 2023, 21:08
So the websocket will remain open unless all subscriptions are closed. If you have multiple subscriptions, you could be running into race conditions where it seems like not all closed , but they all did