π Bug Report: Realtime ws unsubscribe does not work as expected
xuelink opened this issue Β· comments
xue commented
π 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?
- I have read the Code of Conduct
xue commented
Related with #40 , appwrite/appwrite#7676 and appwrite/appwrite#7584
Steven Nguyen commented
@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.