Skip to content

Commit

Permalink
Merge pull request #12 from WolframPRO/ping-identifier-fix
Browse files Browse the repository at this point in the history
Fixed channel identifier check for type ping
  • Loading branch information
nerzh authored Oct 14, 2022
2 parents f3dfd6f + 7d50099 commit 6b85886
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Sources/ActionCableSwift/ACChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,21 @@ public class ACChannel {
guard let self = self else { return }
self.channelSerialQueue.async {
let message = ACSerializer.responseFrom(stringData: text)
guard message.channelName == self.channelName else { return }
switch message.type {
case .confirmSubscription:
let sameChannelName = message.channelName == self.channelName
switch (message.type, sameChannelName) {
case (.confirmSubscription, true):
self.isSubscribed = true
self.executeCallback(callbacks: self.onSubscribe, message: message)
self.flushBuffer()
case .rejectSubscription:
case (.rejectSubscription, true):
self.isSubscribed = false
self.executeCallback(callbacks: self.onRejectSubscription, message: message)
case .cancelSubscription:
case (.cancelSubscription, true):
self.isSubscribed = false
self.executeCallback(callbacks: self.onUnsubscribe, message: message)
case .message:
case (.message, true):
self.executeCallback(callbacks: self.onMessage, message: message)
case .ping:
case (.ping, _):
self.client?.pingRoundWatcher.ping()
self.executeCallback(callbacks: self.onPing)
default: break
Expand Down

0 comments on commit 6b85886

Please sign in to comment.