Skip to content

Commit

Permalink
Merge pull request #187 from xmtp/kele/unsubscribe-from-stream
Browse files Browse the repository at this point in the history
fix: unsubscribe message event
  • Loading branch information
nplasterer committed Dec 18, 2023
2 parents e6053cd + f22e116 commit e95063a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/Conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class Conversation<ContentTypes> {
): () => void {
XMTP.subscribeToMessages(this.client.address, this.topic)
const hasSeen = {}
XMTP.emitter.addListener(
const messageSubscription = XMTP.emitter.addListener(
'message',
async ({
clientAddress,
Expand All @@ -253,6 +253,7 @@ export class Conversation<ContentTypes> {
)

return () => {
messageSubscription.remove()
XMTP.unsubscribeFromMessages(this.client.address, this.topic)
}
}
Expand Down

0 comments on commit e95063a

Please sign in to comment.