Merge branch 'master' into swift2.3
* master: unknown message isn't fatal bump version notify client when engine disconnects
This commit is contained in:
commit
5814e8d275
@ -88,7 +88,7 @@ Carthage
|
|||||||
-----------------
|
-----------------
|
||||||
Add this line to your `Cartfile`:
|
Add this line to your `Cartfile`:
|
||||||
```
|
```
|
||||||
github "socketio/socket.io-client-swift" ~> 6.1.3 # Or latest version
|
github "socketio/socket.io-client-swift" ~> 6.1.4 # Or latest version
|
||||||
```
|
```
|
||||||
|
|
||||||
Run `carthage update --platform ios,macosx`.
|
Run `carthage update --platform ios,macosx`.
|
||||||
@ -102,7 +102,7 @@ source 'https://github.com/CocoaPods/Specs.git'
|
|||||||
platform :ios, '8.0'
|
platform :ios, '8.0'
|
||||||
use_frameworks!
|
use_frameworks!
|
||||||
|
|
||||||
pod 'Socket.IO-Client-Swift', '~> 6.1.3' # Or latest version
|
pod 'Socket.IO-Client-Swift', '~> 6.1.4' # Or latest version
|
||||||
```
|
```
|
||||||
|
|
||||||
Install pods:
|
Install pods:
|
||||||
@ -130,7 +130,7 @@ CocoaSeeds
|
|||||||
Add this line to your `Seedfile`:
|
Add this line to your `Seedfile`:
|
||||||
|
|
||||||
```
|
```
|
||||||
github "socketio/socket.io-client-swift", "v6.1.3", :files => "Source/*.swift" # Or latest version
|
github "socketio/socket.io-client-swift", "v6.1.4", :files => "Source/*.swift" # Or latest version
|
||||||
```
|
```
|
||||||
|
|
||||||
Run `seed install`.
|
Run `seed install`.
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "Socket.IO-Client-Swift"
|
s.name = "Socket.IO-Client-Swift"
|
||||||
s.module_name = "SocketIOClientSwift"
|
s.module_name = "SocketIOClientSwift"
|
||||||
s.version = "6.1.3"
|
s.version = "6.1.4"
|
||||||
s.summary = "Socket.IO-client for iOS and OS X"
|
s.summary = "Socket.IO-client for iOS and OS X"
|
||||||
s.description = <<-DESC
|
s.description = <<-DESC
|
||||||
Socket.IO-client for iOS and OS X.
|
Socket.IO-client for iOS and OS X.
|
||||||
@ -14,7 +14,7 @@ Pod::Spec.new do |s|
|
|||||||
s.ios.deployment_target = '8.0'
|
s.ios.deployment_target = '8.0'
|
||||||
s.osx.deployment_target = '10.10'
|
s.osx.deployment_target = '10.10'
|
||||||
s.tvos.deployment_target = '9.0'
|
s.tvos.deployment_target = '9.0'
|
||||||
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v6.1.3' }
|
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v6.1.4' }
|
||||||
s.source_files = "Source/**/*.swift"
|
s.source_files = "Source/**/*.swift"
|
||||||
s.requires_arc = true
|
s.requires_arc = true
|
||||||
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files
|
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files
|
||||||
|
|||||||
@ -147,7 +147,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
|
|||||||
didError(error)
|
didError(error)
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
didError("Got unknown error from server \(msg)")
|
client?.engineDidError("Got unknown error from server \(msg)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func closeOutEngine() {
|
private func closeOutEngine(reason: String) {
|
||||||
sid = ""
|
sid = ""
|
||||||
closed = true
|
closed = true
|
||||||
invalidated = true
|
invalidated = true
|
||||||
@ -174,6 +174,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
|
|||||||
|
|
||||||
ws?.disconnect()
|
ws?.disconnect()
|
||||||
stopPolling()
|
stopPolling()
|
||||||
|
client?.engineDidClose(reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Starts the connection to the server
|
/// Starts the connection to the server
|
||||||
@ -280,32 +281,30 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func disconnect(reason: String) {
|
public func disconnect(reason: String) {
|
||||||
guard connected else { return closeOutEngine() }
|
guard connected else { return closeOutEngine(reason) }
|
||||||
|
|
||||||
DefaultSocketLogger.Logger.log("Engine is being closed.", type: logType)
|
DefaultSocketLogger.Logger.log("Engine is being closed.", type: logType)
|
||||||
|
|
||||||
if closed {
|
if closed {
|
||||||
closeOutEngine()
|
return closeOutEngine(reason)
|
||||||
client?.engineDidClose(reason)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if websocket {
|
if websocket {
|
||||||
sendWebSocketMessage("", withType: .Close, withData: [])
|
sendWebSocketMessage("", withType: .Close, withData: [])
|
||||||
closeOutEngine()
|
closeOutEngine(reason)
|
||||||
} else {
|
} else {
|
||||||
disconnectPolling()
|
disconnectPolling(reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to take special care when we're polling that we send it ASAP
|
// We need to take special care when we're polling that we send it ASAP
|
||||||
// Also make sure we're on the emitQueue since we're touching postWait
|
// Also make sure we're on the emitQueue since we're touching postWait
|
||||||
private func disconnectPolling() {
|
private func disconnectPolling(reason: String) {
|
||||||
dispatch_sync(emitQueue) {
|
dispatch_sync(emitQueue) {
|
||||||
self.postWait.append(String(SocketEnginePacketType.Close.rawValue))
|
self.postWait.append(String(SocketEnginePacketType.Close.rawValue))
|
||||||
let req = self.createRequestForPostWithPostWait()
|
let req = self.createRequestForPostWithPostWait()
|
||||||
self.doRequest(req) {_, _, _ in }
|
self.doRequest(req) {_, _, _ in }
|
||||||
self.closeOutEngine()
|
self.closeOutEngine(reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user