merge development

This commit is contained in:
Erik 2016-06-24 02:53:31 -04:00
commit c129118496
3 changed files with 71 additions and 72 deletions

View File

@ -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.2 # 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.2' # 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.2", :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`.

View File

@ -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.2" 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.2' } 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

View File

@ -147,7 +147,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
didError(reason: error) didError(reason: error)
} }
} catch { } catch {
didError(reason: "Got unknown error from server \(msg)") client?.engineDidError(reason: "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: reason)
} }
/// Starts the connection to the server /// Starts the connection to the server
@ -278,32 +279,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: 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: reason)
client?.engineDidClose(reason: reason)
return
} }
if websocket { if websocket {
sendWebSocketMessage("", withType: .close, withData: []) sendWebSocketMessage("", withType: .close, withData: [])
closeOutEngine() closeOutEngine(reason: reason)
} else { } else {
disconnectPolling() disconnectPolling(reason: 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) {
emitQueue.sync { emitQueue.sync {
self.postWait.append(String(SocketEnginePacketType.close.rawValue)) self.postWait.append(String(SocketEnginePacketType.close.rawValue))
let req = self.createRequestForPostWithPostWait() let req = self.createRequestForPostWithPostWait()
self.doRequest(for: req) {_, _, _ in } self.doRequest(for: req) {_, _, _ in }
self.closeOutEngine() self.closeOutEngine(reason: reason)
} }
} }