Skip to content

Commit 9c5a985

Browse files
Merge pull request #809 from appwrite/fix-web-realtime
close realtime socket properly on unsubscribe
2 parents d875e74 + 421564a commit 9c5a985

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

templates/web/src/client.ts.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,11 @@ class Client {
186186
}
187187
},
188188
createSocket: () => {
189-
if (this.realtime.channels.size < 1) return;
189+
if (this.realtime.channels.size < 1) {
190+
this.realtime.reconnect = false;
191+
this.realtime.socket?.close();
192+
return;
193+
}
190194

191195
const channels = new URLSearchParams();
192196
channels.set('project', this.config.project);

0 commit comments

Comments
 (0)