-
Notifications
You must be signed in to change notification settings - Fork 168
Open
Description
Currently, subscribedToChannel is called only when receiving the pusher_internal:subscription_succeeded with data
When subscribing to private channel, the event comes without data, so it won't pass this and notify the delegate
pusher-websocket-swift/Sources/Services/PusherConnection.swift
Lines 456 to 459 in d8d7a77
| guard event.data != nil else { | |
| Logger.shared.debug(for: .subscriptionSucceededNoDataInPayload) | |
| return | |
| } |
But that was not the case 8 yr ago,
pusher-websocket-swift/Source/PusherConnection.swift
Lines 304 to 327 in d064eab
| chan.subscribed = true | |
| if let eData = json["data"] as? String { | |
| callGlobalCallbacks(forEvent: "pusher:subscription_succeeded", jsonObject: json) | |
| chan.handleEvent(name: "pusher:subscription_succeeded", data: eData) | |
| } | |
| if PusherChannelType.isPresenceChannel(name: channelName) { | |
| if let presChan = self.channels.find(name: channelName) as? PusherPresenceChannel { | |
| if let data = json["data"] as? String, let dataJSON = getPusherEventJSON(from: data) { | |
| if let presenceData = dataJSON["presence"] as? [String : AnyObject], | |
| let presenceHash = presenceData["hash"] as? [String : AnyObject] { | |
| presChan.addExistingMembers(memberHash: presenceHash) | |
| } | |
| } | |
| } | |
| } | |
| self.delegate?.subscribedToChannel?(name: channelName) | |
| while chan.unsentEvents.count > 0 { | |
| if let pusherEvent = chan.unsentEvents.popLast() { | |
| chan.trigger(eventName: pusherEvent.name, data: pusherEvent.data) | |
| } | |
| } |
subscribedToChannel was called regardless whether the event comes with data.
Can we restore this behavior? Like calling subscribedToChannel before return on else branch of the guard clause.
Metadata
Metadata
Assignees
Labels
No labels