Skip to content

Commit

Permalink
fix(Messaging): Fix memory leak on unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
hchristine committed Jun 18, 2024
1 parent 85327c8 commit b0075ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ client.messaging.subscribe('topic', (data) => {
```

#### Unsubscribe from the topic

To unsubscribe from the topic:
```ts
client.messaging.unsubscribe('topic');
Expand Down
2 changes: 2 additions & 0 deletions src/modules/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export class Messaging implements IMessaging {
const queryId = this.genId();

this.socket.write(unsubscribe(queryId, topic));

this.listeners.delete(topic);
}

trigger(message: MessagingEvent) {
Expand Down

0 comments on commit b0075ac

Please sign in to comment.