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

🐛 Bug Report: Web SDK fails to disconnect when the unsubscribe function is returned #7584

Closed
2 tasks done
collinmyers opened this issue Feb 13, 2024 · 6 comments
Closed
2 tasks done
Labels
api / realtime Fixes and upgrades for the Appwrite Realtime API. bug Something isn't working

Comments

@collinmyers
Copy link

👟 Reproduction steps

subscribe

useFocusEffect
This occurs with both the useEffect and useFocusEffect hooks. Upon subscribing to the real-time event from the database, you receive a function within the logic to eventually unsubscribe. When navigating away from the page, the components in the return statement of the useEffect or useFocusEffect should execute. The function returned from the subscribe operation should disconnect the real-time connection.

👍 Expected behavior

Upon unmounting the component, the unsubscribe function should terminate the real-time connection.

👎 Actual Behavior

The real-time connection remains active even after the component has been unmounted.

🎲 Appwrite version

Version 1.4.x

💻 Operating system

Windows

🧱 Your Environment

I'm utilizing Appwrite v1.4.13, along with SDK version 13.0.1, in a self-hosted environment. This setup is integrated within a React Native application.

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

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@collinmyers collinmyers added the bug Something isn't working label Feb 13, 2024
@stnguyen90 stnguyen90 changed the title Appwrite Web SDK fails to disconnect when the unsubscribe function is returned🐛 Bug Report: 🐛 Bug Report: Appwrite Web SDK fails to disconnect when the unsubscribe function is returned Feb 13, 2024
@stnguyen90 stnguyen90 added the api / realtime Fixes and upgrades for the Appwrite Realtime API. label Feb 13, 2024
@stnguyen90 stnguyen90 changed the title 🐛 Bug Report: Appwrite Web SDK fails to disconnect when the unsubscribe function is returned 🐛 Bug Report: Web SDK fails to disconnect when the unsubscribe function is returned Feb 13, 2024
@stnguyen90
Copy link
Contributor

@collinmyers, thanks for raising this issue! 🙏🏼 This definitely looks like a bug in the SDK. It doesn't look the the SDK is closing the websocket because of this code: https://github.com/appwrite/sdk-for-web/blob/ca8cb1d9f2c0393ec99c7d5cb50f3be543987918/src/client.ts#L211

Related Discord thread: https://discord.com/channels/564160730845151244/1201047679338295429

@xuelink
Copy link
Contributor

xuelink commented Mar 8, 2024

Waiting for update about this issue, it was really headache for my chat app 🚀

@xuelink
Copy link
Contributor

xuelink commented Mar 28, 2024

Any updates here ?

@ZachHandley
Copy link

ZachHandley commented Apr 16, 2024

@xuelink https://github.com/ZachHandley/AppwriteReactRealtimeTest can you fork this and give me a reproducible example perchance -- this is 1.5, but I imported the built SDK right in and I don't think the Realtime changed in between, but I can test it on 1.4 if there's an issue

Can't seem to get it to break myself though that's a really simple example

@xuelink
Copy link
Contributor

xuelink commented Apr 16, 2024

@xuelink https://github.com/ZachHandley/AppwriteReactRealtimeTest can you fork this and give me a reproducible example perchance -- this is 1.5, but I imported the built SDK right in and I don't think the Realtime changed in between, but I can test it on 1.4 if there's an issue

Can't seem to get it to break myself though that's a really simple example

@ZachHandley Thank you for your interest here but im not comfortable with react well, so maybe @collinmyers can do it for reproduction for you to understand easily.

This closed issue is the same issue as reproduced with angular: appwrite/sdk-for-web#91

I just bypassed this issue by forking sdk and commenting this related line temporarily. ref

@stnguyen90
Copy link
Contributor

Fixed in appwrite/sdk-for-web#93

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. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants