Merge pull request #408 from socketio/development

Development
This commit is contained in:
Erik Little 2016-06-24 02:41:22 -04:00 committed by GitHub
commit 05c0874f32
3 changed files with 14 additions and 15 deletions

View File

@ -88,7 +88,7 @@ Carthage
-----------------
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`.
@ -102,7 +102,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
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:
@ -130,7 +130,7 @@ CocoaSeeds
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`.

View File

@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift"
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.description = <<-DESC
Socket.IO-client for iOS and OS X.
@ -14,7 +14,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
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.requires_arc = true
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files

View File

@ -147,7 +147,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
didError(error)
}
} 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 = ""
closed = true
invalidated = true
@ -174,6 +174,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
ws?.disconnect()
stopPolling()
client?.engineDidClose(reason)
}
/// Starts the connection to the server
@ -280,32 +281,30 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
}
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)
if closed {
closeOutEngine()
client?.engineDidClose(reason)
return
return closeOutEngine(reason)
}
if websocket {
sendWebSocketMessage("", withType: .Close, withData: [])
closeOutEngine()
closeOutEngine(reason)
} else {
disconnectPolling()
disconnectPolling(reason)
}
}
// 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
private func disconnectPolling() {
private func disconnectPolling(reason: String) {
dispatch_sync(emitQueue) {
self.postWait.append(String(SocketEnginePacketType.Close.rawValue))
let req = self.createRequestForPostWithPostWait()
self.doRequest(req) {_, _, _ in }
self.closeOutEngine()
self.closeOutEngine(reason)
}
}