Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a412eef268 | ||
|
|
7d07e55ce5 | ||
|
|
e8c3e22dc6 | ||
|
|
cf12865aa0 | ||
|
|
2200972f4d |
No files matched your search
@@ -91,7 +91,7 @@ Carthage
|
||||
-----------------
|
||||
Add this line to your `Cartfile`:
|
||||
```
|
||||
github "socketio/socket.io-client-swift" ~> 7.0.1 # Or latest version
|
||||
github "socketio/socket.io-client-swift" ~> 7.0.3 # 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.1' # Or latest version
|
||||
pod 'Socket.IO-Client-Swift', '~> 7.0.3' # Or latest version
|
||||
end
|
||||
```
|
||||
|
||||
@@ -133,7 +133,7 @@ CocoaSeeds
|
||||
Add this line to your `Seedfile`:
|
||||
|
||||
```
|
||||
github "socketio/socket.io-client-swift", "v7.0.1", :files => "Source/*.swift" # Or latest version
|
||||
github "socketio/socket.io-client-swift", "v7.0.3", :files => "Source/*.swift" # Or latest version
|
||||
```
|
||||
|
||||
Run `seed install`.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Socket.IO-Client-Swift"
|
||||
s.module_name = "SocketIOClientSwift"
|
||||
s.version = "7.0.1"
|
||||
s.module_name = "SocketIO"
|
||||
s.version = "7.0.3"
|
||||
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.1' }
|
||||
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v7.0.3' }
|
||||
s.source_files = "Source/**/*.swift"
|
||||
s.requires_arc = true
|
||||
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files
|
||||
|
||||
@@ -359,7 +359,7 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo
|
||||
private func handleOpen(openData: String) {
|
||||
do {
|
||||
let json = try openData.toNSDictionary()
|
||||
guard let sid = json[sid] as? String else {
|
||||
guard let sid = json["sid"] as? String else {
|
||||
client?.engineDidError("Open packet contained no sid")
|
||||
return
|
||||
}
|
||||
|
||||
+21
-22
@@ -67,7 +67,7 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
|
||||
return nsp + "#" + (engine?.sid ?? "")
|
||||
}
|
||||
|
||||
/// Type safe way to create a new SocketIOClient. opts can be omitted
|
||||
/// Type safe way to create a new SocketIOClient. config can be omitted
|
||||
public init(socketURL: NSURL, config: SocketIOClientConfiguration = []) {
|
||||
self.config = config
|
||||
self.socketURL = socketURL
|
||||
@@ -150,12 +150,12 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
|
||||
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeoutAfter) * Int64(NSEC_PER_SEC))
|
||||
|
||||
dispatch_after(time, handleQueue) {[weak self] in
|
||||
if let this = self where this.status != .Connected && this.status != .Disconnected {
|
||||
this.status = .Disconnected
|
||||
this.engine?.disconnect("Connect timeout")
|
||||
|
||||
handler?()
|
||||
}
|
||||
guard let this = self where this.status != .Connected && this.status != .Disconnected else { return }
|
||||
|
||||
this.status = .Disconnected
|
||||
this.engine?.disconnect("Connect timeout")
|
||||
|
||||
handler?()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,20 +163,20 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
|
||||
currentAck += 1
|
||||
|
||||
return {[weak self, ack = currentAck] timeout, callback in
|
||||
if let this = self {
|
||||
dispatch_sync(this.ackQueue) {
|
||||
this.ackHandlers.addAck(ack, callback: callback)
|
||||
}
|
||||
|
||||
guard let this = self else { return }
|
||||
|
||||
dispatch_sync(this.ackQueue) {
|
||||
this.ackHandlers.addAck(ack, callback: callback)
|
||||
}
|
||||
|
||||
|
||||
this._emit(items, ack: ack)
|
||||
|
||||
if timeout != 0 {
|
||||
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeout * NSEC_PER_SEC))
|
||||
|
||||
this._emit(items, ack: ack)
|
||||
|
||||
if timeout != 0 {
|
||||
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeout * NSEC_PER_SEC))
|
||||
|
||||
dispatch_after(time, this.ackQueue) {
|
||||
this.ackHandlers.timeoutAck(ack, onQueue: this.handleQueue)
|
||||
}
|
||||
dispatch_after(time, this.ackQueue) {
|
||||
this.ackHandlers.timeoutAck(ack, onQueue: this.handleQueue)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,6 +196,7 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
|
||||
|
||||
DefaultSocketLogger.Logger.log("Disconnected: %@", type: logType, args: reason)
|
||||
|
||||
reconnecting = false
|
||||
status = .Disconnected
|
||||
|
||||
// Make sure the engine is actually dead.
|
||||
@@ -205,8 +206,6 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
|
||||
|
||||
/// Disconnects the socket.
|
||||
public func disconnect() {
|
||||
assert(status != .NotConnected, "Tried closing a NotConnected client")
|
||||
|
||||
DefaultSocketLogger.Logger.log("Closing socket", type: logType)
|
||||
|
||||
didDisconnect("Disconnect")
|
||||
|
||||
Reference in new issue
Block a user