Skip to content

Commit

Permalink
Don't cancel all subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
nakajima committed Sep 21, 2023
1 parent fe69a54 commit d5f5c21
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ios/XMTPModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,10 @@ public class XMTPModule: Module {
return
}

await subscriptionsManager.getSubscription(key: "conversations")?.cancel()
await subscriptionsManager.updateSubscription(key: "conversations", task: Task {
await subscriptionsManager.getSubscription(key: "conversations:\(client.address)")?.cancel()
await subscriptionsManager.updateSubscription(key: "conversations:\(client.address)", task: Task {
do {
for try await conversation in try await client.conversations.stream() {
for try await conversation in await client.conversations.stream() {
try sendEvent("conversation", [
"clientAddress": clientAddress,
"conversation": ConversationWrapper.encodeToObj(conversation, client: client),
Expand All @@ -591,8 +591,8 @@ public class XMTPModule: Module {
return
}

await subscriptionsManager.getSubscription(key: "messages")?.cancel()
await subscriptionsManager.updateSubscription(key: "messages", task: Task {
await subscriptionsManager.getSubscription(key: "messages:\(client.address)")?.cancel()
await subscriptionsManager.updateSubscription(key: "messages:\(client.address)", task: Task {
do {
for try await message in try await client.conversations.streamAllMessages() {
do {
Expand Down

0 comments on commit d5f5c21

Please sign in to comment.