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: Realtime ws unsubscribe does not work as expected #91

Closed
2 tasks done
xuelink opened this issue Mar 8, 2024 · 2 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@xuelink
Copy link

xuelink commented Mar 8, 2024

👟 Reproduction steps

unsubscribe does not work as expected for the following code block

  startListener() {
    if (!this.listenerFn) {
      this.listenerFn = this.notification.connect();
    }
  }

  unsubscribeListener() {
    // Stop listening to notifications
    if (this.listenerFn) {
      this.listenerFn();
      console.log('Notification Service stopped');
    }

doc ref:

import { Client } from "appwrite";

const client = new Client()
    .setEndpoint('https://cloud.appwrite.io/v1')
    .setProject('<PROJECT_ID>');

const unsubscribe = client.subscribe('files', response => {
    // Callback will be executed on changes for all files.
    console.log(response);
});

// Closes the subscription.
unsubscribe();

demo video:

👍 Expected behavior

it should close the websocket totally. i can see the network tab of inspector

👎 Actual Behavior

when i call unsubscribe, it doesnt trigger to and after logout it continues to listen.

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

MacOS

🧱 Your Environment

appwrite version 1.4.13
sdk for web "appwrite": "^13.0.0",

👀 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?

@xuelink xuelink added the bug Something isn't working label Mar 8, 2024
@xuelink
Copy link
Author

xuelink commented Mar 8, 2024

Related with #40 , appwrite/appwrite#7676 and appwrite/appwrite#7584

@stnguyen90
Copy link
Contributor

@behics, thanks for creating this issue! 🙏🏼 Since we already have appwrite/appwrite#7584. It would be good to just use that 1 issue. Please make sure to add a 👍🏼 to that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants