Compare commits

...
4 Commits
Author SHA1 Message Date
Erik c7c824c3c5 bump version 2016-08-27 13:08:09 -04:00
Erik 89ab458a5f Merge branch 'development'
* development:
  Refactor engine. Fix infinite recursion in configuration
  Don't send whole packet to handleConnect
2016-08-27 13:07:26 -04:00
Erik bd7f94333d Refactor engine. Fix infinite recursion in configuration 2016-08-27 13:05:22 -04:00
Erik 4de7a48e87 Don't send whole packet to handleConnect 2016-08-27 11:37:13 -04:00
5 changed files with 40 additions and 38 deletions

No files matched your search

+3 -3
View File
@@ -91,7 +91,7 @@ Carthage
-----------------
Add this line to your `Cartfile`:
```
github "socketio/socket.io-client-swift" ~> 7.0.0 # Or latest version
github "socketio/socket.io-client-swift" ~> 7.0.1 # Or latest version
```
Run `carthage update --platform ios,macosx`.
@@ -104,7 +104,7 @@ Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
use_frameworks!
target 'YourApp' do
pod 'Socket.IO-Client-Swift', '~> 7.0.0' # Or latest version
pod 'Socket.IO-Client-Swift', '~> 7.0.1' # Or latest version
end
```
@@ -133,7 +133,7 @@ CocoaSeeds
Add this line to your `Seedfile`:
```
github "socketio/socket.io-client-swift", "v7.0.0", :files => "Source/*.swift" # Or latest version
github "socketio/socket.io-client-swift", "v7.0.1", :files => "Source/*.swift" # Or latest version
```
Run `seed install`.
+2 -2
View File
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift"
s.module_name = "SocketIOClientSwift"
s.version = "7.0.0"
s.version = "7.0.1"
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 => 'v7.0.0' }
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v7.0.1' }
s.source_files = "Source/**/*.swift"
s.requires_arc = true
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files
+31 -29
View File
@@ -359,36 +359,38 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo
private func handleOpen(openData: String) {
do {
let json = try openData.toNSDictionary()
if let sid = json["sid"] as? String {
let upgradeWs: Bool
self.sid = sid
connected = true
if let upgrades = json["upgrades"] as? [String] {
upgradeWs = upgrades.contains("websocket")
} 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 {
createWebsocketAndConnect()
}
sendPing()
if !forceWebsockets {
doPoll()
}
client?.engineDidOpen("Connect")
guard let sid = json[sid] as? String else {
client?.engineDidError("Open packet contained no sid")
return
}
let upgradeWs: Bool
self.sid = sid
connected = true
if let upgrades = json["upgrades"] as? [String] {
upgradeWs = upgrades.contains("websocket")
} 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 {
createWebsocketAndConnect()
}
sendPing()
if !forceWebsockets {
doPoll()
}
client?.engineDidOpen("Connect")
} catch {
didError("Error parsing open packet")
}
+1 -1
View File
@@ -97,7 +97,7 @@ public struct SocketIOClientConfiguration : ArrayLiteralConvertible, CollectionT
@warn_unused_result
public func prefixThrough(position: Index) -> SubSequence {
return prefixThrough(position)
return backingArray.prefixThrough(position)
}
@warn_unused_result
+3 -3
View File
@@ -32,8 +32,8 @@ extension SocketParsable {
return nsp == self.nsp
}
private func handleConnect(p: SocketPacket) {
if p.nsp == "/" && nsp != "/" {
private func handleConnect(packetNamespace: String) {
if packetNamespace == "/" && nsp != "/" {
joinNamespace(nsp)
} else {
didConnect()
@@ -51,7 +51,7 @@ extension SocketParsable {
case .BinaryAck where isCorrectNamespace(pack.nsp):
waitingPackets.append(pack)
case .Connect:
handleConnect(pack)
handleConnect(pack.nsp)
case .Disconnect:
didDisconnect("Got Disconnect")
case .Error: