merge master

This commit is contained in:
Erik 2015-08-31 09:34:14 -04:00
commit 8dc7121355
3 changed files with 16 additions and 8 deletions

View File

@ -61,7 +61,7 @@ Carthage
-----------------
Add this line to your `Cartfile`:
```
github "socketio/socket.io-client-swift" ~> 2.4.0 # Or latest version
github "socketio/socket.io-client-swift" ~> 2.4.3 # Or latest version
```
Run `carthage update`.
@ -80,7 +80,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Socket.IO-Client-Swift', '~> 2.4.0' # Or latest version
pod 'Socket.IO-Client-Swift', '~> 2.4.3' # Or latest version
```
Install pods:

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift"
s.version = "2.4.0"
s.version = "2.4.3"
s.summary = "Socket.IO-client for iOS and OS X"
s.description = <<-DESC
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.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v2.4.0' }
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v2.4.3' }
s.source_files = "SocketIOClientSwift/**/*.swift"
s.requires_arc = true
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files

View File

@ -387,25 +387,33 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
private func handleOpen(openData: String) {
let mesData = openData.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
do {
let json = try NSJSONSerialization.JSONObjectWithData(mesData,
options: NSJSONReadingOptions.AllowFragments) as? NSDictionary
if let sid = json?["sid"] as? String {
let upgradeWs: Bool
self.sid = sid
connected = true
if !forcePolling && !forceWebsockets {
createWebsocket(andConnect: true)
if let upgrades = json?["upgrades"] as? [String] {
upgradeWs = upgrades.filter {$0 == "websocket"}.count != 0
} else {
upgradeWs = false
}
if let pingInterval = json?["pingInterval"] as? Double, pingTimeout = json?["pingTimeout"] as? Double {
self.pingInterval = pingInterval / 1000.0
self.pingTimeout = pingTimeout / 1000.0
}
if !forcePolling && !forceWebsockets && upgradeWs {
createWebsocket(andConnect: true)
}
}
} catch {
SocketLogger.err("Error parsing open packet", client: self)
return
}
startPingTimer()