diff --git a/PusherSwift.podspec b/PusherSwift.podspec
index 3502d6f5..790cb362 100644
--- a/PusherSwift.podspec
+++ b/PusherSwift.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PusherSwift'
- s.version = '10.1.1'
+ s.version = '10.1.2'
s.summary = 'A Pusher client library in Swift'
s.homepage = 'https://github.com/pusher/pusher-websocket-swift'
s.license = 'MIT'
diff --git a/PusherSwiftWithEncryption.podspec b/PusherSwiftWithEncryption.podspec
index 220d694d..185f05c4 100644
--- a/PusherSwiftWithEncryption.podspec
+++ b/PusherSwiftWithEncryption.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PusherSwiftWithEncryption'
- s.version = '10.1.1'
+ s.version = '10.1.2'
s.summary = 'A Pusher client library in Swift that supports encrypted channels'
s.homepage = 'https://github.com/pusher/pusher-websocket-swift'
s.license = 'MIT'
diff --git a/Sources/Extensions/PusherConnection+WebsocketDelegate.swift b/Sources/Extensions/PusherConnection+WebsocketDelegate.swift
index bfc3fb46..166b627b 100644
--- a/Sources/Extensions/PusherConnection+WebsocketDelegate.swift
+++ b/Sources/Extensions/PusherConnection+WebsocketDelegate.swift
@@ -50,18 +50,7 @@ extension PusherConnection: WebSocketConnectionDelegate {
public func webSocketDidDisconnect(connection: WebSocketConnection,
closeCode: NWProtocolWebSocket.CloseCode,
reason: Data?) {
- // Handles setting channel subscriptions to unsubscribed whether disconnection
- // is intentional or not
- if connectionState == .disconnecting || connectionState == .connected {
- for (_, channel) in self.channels.channels {
- channel.subscribed = false
- }
- }
-
- self.connectionEstablishedMessageReceived = false
- self.socketConnected = false
-
- updateConnectionState(to: .disconnected)
+ resetConnection()
guard !intentionalDisconnect else {
Logger.shared.debug(for: .intentionalDisconnection)
diff --git a/Sources/Info.plist b/Sources/Info.plist
index 8fb0c957..bc16c372 100644
--- a/Sources/Info.plist
+++ b/Sources/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 10.1.1
+ 10.1.2
CFBundleSignature
????
CFBundleVersion
diff --git a/Sources/PusherSwift.swift b/Sources/PusherSwift.swift
index 21161663..c980eada 100644
--- a/Sources/PusherSwift.swift
+++ b/Sources/PusherSwift.swift
@@ -2,7 +2,7 @@ import Foundation
import NWWebSocket
let PROTOCOL = 7
-let VERSION = "10.1.1"
+let VERSION = "10.1.2"
// swiftlint:disable:next identifier_name
let CLIENT_NAME = "pusher-websocket-swift"
diff --git a/Sources/Services/PusherConnection.swift b/Sources/Services/PusherConnection.swift
index c31460e9..87325c2b 100644
--- a/Sources/Services/PusherConnection.swift
+++ b/Sources/Services/PusherConnection.swift
@@ -343,12 +343,7 @@ import NWWebSocket
}
}
- /**
- Set the connection state to disconnected, mark channels as unsubscribed,
- reset connection-related state to initial state, and initiate reconnect
- process
- */
- private func resetConnectionAndAttemptReconnect() {
+ internal func resetConnection() {
if connectionState != .disconnected {
updateConnectionState(to: .disconnected)
}
@@ -362,7 +357,16 @@ import NWWebSocket
socketConnected = false
connectionEstablishedMessageReceived = false
socketId = nil
-
+ }
+
+ /**
+ Set the connection state to disconnected, mark channels as unsubscribed,
+ reset connection-related state to initial state, and initiate reconnect
+ process
+ */
+ private func resetConnectionAndAttemptReconnect() {
+ resetConnection()
+
guard !intentionalDisconnect else {
return
}
@@ -463,7 +467,7 @@ import NWWebSocket
}
}
}
-
+
let subscriptionEvent = event.copy(withEventName: Constants.Events.Pusher.subscriptionSucceeded)
callGlobalCallbacks(event: subscriptionEvent)
chan.handleEvent(event: subscriptionEvent)
@@ -553,13 +557,13 @@ import NWWebSocket
Logger.shared.debug(for: .unableToRemoveMemberFromChannel)
}
}
-
+
/**
Handle subscription count event
-
+
- parameter event: The event to be processed
*/
-
+
private func handleSubscriptionCountEvent(event: PusherEvent) {
guard let channelName = event.channelName,
let channel = self.channels.find(name: channelName),
@@ -567,7 +571,7 @@ import NWWebSocket
let count = subscriptionCountData[Constants.JSONKeys.subscriptionCount] as? Int else {
return
}
-
+
channel.updateSubscriptionCount(count: count)
}
@@ -628,7 +632,7 @@ import NWWebSocket
case Constants.Events.PusherInternal.memberRemoved:
handleMemberRemovedEvent(event: event)
-
+
case Constants.Events.PusherInternal.subscriptionCount:
handleSubscriptionCountEvent(event: event)
@@ -652,14 +656,14 @@ import NWWebSocket
}
/**
- Uses the appropriate authentication method to authenticate subscriptions to private and
+ Uses the appropriate authorization method to authorize subscriptions to private and
presence channels
- - parameter channel: The PusherChannel to authenticate
- - parameter auth: A PusherAuth value if subscription is being made to an
- authenticated channel without using the default auth methods
+ - parameter channel: The PusherChannel to authorize
+ - parameter auth: A PusherAuth value if subscription is being made to a
+ channel without using the default authorization method
- - returns: A Bool indicating whether or not the authentication request was made
+ - returns: A Bool indicating whether or not the authorization request was made
successfully
*/
private func authorize(_ channel: PusherChannel, auth: PusherAuth? = nil) -> Bool {
diff --git a/Tests/Info.plist b/Tests/Info.plist
index d4dfa653..a18c993c 100644
--- a/Tests/Info.plist
+++ b/Tests/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 10.1.1
+ 10.1.2
CFBundleSignature
????
CFBundleVersion
diff --git a/Tests/Integration/PusherClientInitializationTests.swift b/Tests/Integration/PusherClientInitializationTests.swift
index c27ef974..e3edb142 100644
--- a/Tests/Integration/PusherClientInitializationTests.swift
+++ b/Tests/Integration/PusherClientInitializationTests.swift
@@ -2,7 +2,7 @@ import XCTest
@testable import PusherSwift
-let VERSION = "10.1.1"
+let VERSION = "10.1.2"
class ClientInitializationTests: XCTestCase {
private var key: String!
diff --git a/Tests/Integration/PusherTopLevelAPITests.swift b/Tests/Integration/PusherTopLevelAPITests.swift
index 3f0819ad..563e63ed 100644
--- a/Tests/Integration/PusherTopLevelAPITests.swift
+++ b/Tests/Integration/PusherTopLevelAPITests.swift
@@ -138,7 +138,6 @@ class PusherTopLevelApiTests: XCTestCase {
let chan = pusher.subscribe(TestObjects.Event.testChannelName)
connectionDelegate.registerCallback(connectionState: ConnectionState.disconnected) {
- XCTAssertFalse(chan.subscribed)
disconnected.fulfill()
}
@@ -150,6 +149,7 @@ class PusherTopLevelApiTests: XCTestCase {
pusher.connect()
waitForExpectations(timeout: 0.5)
+ XCTAssertFalse(chan.subscribed)
}
/* subscribing to channels when already connected */