Skip to content

Commit 5b6ee3d

Browse files
MOB-917 Fix Pusher emitting multiple events on Closed Thread (#107)
- After Pusher emits its success or failure response, subscribe from the event and close the pusher connection
1 parent eb31835 commit 5b6ee3d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/PaystackSDK/Core/Service/Subscription/PusherSubscriptionListener.swift

+4
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ struct PusherSubscriptionListener: SubscriptionListener {
5757
channel.bind(eventName: eventName, eventCallback: {
5858
guard let stringData = $0.data else {
5959
subscriptionResponse(.failure(.noData))
60+
pusher.unsubscribe($0.channelName ?? "")
61+
pusher.disconnect()
6062
return
6163
}
6264
subscriptionResponse(.success(stringData))
65+
pusher.unsubscribe($0.channelName ?? "")
66+
pusher.disconnect()
6367
})
6468

6569
}

0 commit comments

Comments
 (0)