merge master

This commit is contained in:
Erik 2015-06-24 07:05:38 -04:00
commit 362f4e90b8
2 changed files with 144 additions and 145 deletions

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift" s.name = "Socket.IO-Client-Swift"
s.version = "2.3.5" s.version = "2.3.6"
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.
@ -12,7 +12,7 @@ Pod::Spec.new do |s|
s.author = { "Erik" => "nuclear.ace@gmail.com" } s.author = { "Erik" => "nuclear.ace@gmail.com" }
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.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v2.3.5' } s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v2.3.6' }
s.source_files = "SocketIOClientSwift/**/*.swift" s.source_files = "SocketIOClientSwift/**/*.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

@ -40,11 +40,11 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
private var fastUpgrade = false private var fastUpgrade = false
private var forcePolling = false private var forcePolling = false
private var forceWebsockets = false private var forceWebsockets = false
private var pingInterval:Int? private var pingInterval:Double?
private var pingTimer:NSTimer? private var pingTimer:NSTimer?
private var pingTimeout = 0 { private var pingTimeout = 0.0 {
didSet { didSet {
pongsMissedMax = pingTimeout / (pingInterval ?? 25) pongsMissedMax = Int(pingTimeout / (pingInterval ?? 25))
} }
} }
private var pongsMissed = 0 private var pongsMissed = 0
@ -404,9 +404,9 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
createWebsocket(andConnect: true) createWebsocket(andConnect: true)
} }
if let pingInterval = json?["pingInterval"] as? Int, pingTimeout = json?["pingTimeout"] as? Int { if let pingInterval = json?["pingInterval"] as? Double, pingTimeout = json?["pingTimeout"] as? Double {
self.pingInterval = pingInterval / 1000 self.pingInterval = pingInterval / 1000.0
self.pingTimeout = pingTimeout / 1000 self.pingTimeout = pingTimeout / 1000.0
} }
} }
} catch { } catch {
@ -650,8 +650,7 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
pingTimer?.invalidate() pingTimer?.invalidate()
dispatch_async(dispatch_get_main_queue()) {[weak self] in dispatch_async(dispatch_get_main_queue()) {[weak self] in
if let this = self { if let this = self {
this.pingTimer = NSTimer.scheduledTimerWithTimeInterval(NSTimeInterval(this.pingInterval!), this.pingTimer = NSTimer.scheduledTimerWithTimeInterval(this.pingInterval!, target: this,
target: this,
selector: Selector("sendPing"), userInfo: nil, repeats: true) selector: Selector("sendPing"), userInfo: nil, repeats: true)
} }
} }