From 47a839b934e00d36cdfe24fb01c4e7d41938e9c2 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 22 Jul 2015 19:09:47 -0400 Subject: [PATCH 1/4] change api for emitack callback --- SocketIOClientSwift/SocketTypes.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SocketIOClientSwift/SocketTypes.swift b/SocketIOClientSwift/SocketTypes.swift index 8562024..d0e5df0 100644 --- a/SocketIOClientSwift/SocketTypes.swift +++ b/SocketIOClientSwift/SocketTypes.swift @@ -31,4 +31,4 @@ import Foundation public typealias AckCallback = @objc_block (NSArray?) -> Void public typealias AckEmitter = (AnyObject...) -> Void public typealias NormalCallback = (NSArray?, AckEmitter?) -> Void -public typealias OnAckCallback = (timeout:UInt64, callback:AckCallback) -> Void +public typealias OnAckCallback = (timeoutAfter:UInt64, callback:AckCallback) -> Void From 11730b5fcd92db1750dd2163b0864cf603e06803 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 22 Jul 2015 19:10:55 -0400 Subject: [PATCH 2/4] update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 657f2e7..f5b3398 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ socket.on("connect") {data, ack in socket.on("currentAmount") {data, ack in if let cur = data?[0] as? Double { - socket.emitWithAck("canUpdate", cur)(timeout: 0) {data in + socket.emitWithAck("canUpdate", cur)(timeoutAfter: 0) {data in socket.emit("update", ["amount": cur + 2.50]) } @@ -128,7 +128,7 @@ Methods 2. `onAny(callback:((event:String, items:AnyObject?)) -> Void)` - Adds a handler for all events. It will be called on any received event. 3. `emit(event:String, _ items:AnyObject...)` - Sends a message. Can send multiple items. 4. `emit(event:String, withItems items:[AnyObject])` - `emit` for Objective-C -5. `emitWithAck(event:String, _ items:AnyObject...) -> (timeout:UInt64, callback:(NSArray?) -> Void) -> Void` - Sends a message that requests an acknowledgement from the server. Returns a function which you can use to add a handler. See example. Note: The message is not sent until you call the returned function. +5. `emitWithAck(event:String, _ items:AnyObject...) -> (timeoutAfter:UInt64, callback:(NSArray?) -> Void) -> Void` - Sends a message that requests an acknowledgement from the server. Returns a function which you can use to add a handler. See example. Note: The message is not sent until you call the returned function. 6. `emitWithAck(event:String, withItems items:[AnyObject]) -> (UInt64, (NSArray?) -> Void) -> Void` - `emitWithAck` for Objective-C. Note: The message is not sent until you call the returned function. 7. `connect()` - Establishes a connection to the server. A "connect" event is fired upon successful connection. 8. `connect(#timeoutAfter:Int, withTimeoutHandler handler:(() -> Void)?)` - Connect to the server. If it isn't connected after timeoutAfter seconds, the handler is called. From 67f57daaab477f9fe77c824f6b4dcd6bd69bc266 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 24 Jul 2015 08:00:31 -0400 Subject: [PATCH 3/4] bump version --- README.md | 4 ++-- Socket.IO-Client-Swift.podspec | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f5b3398..bc30ccd 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Carthage ----------------- Add this line to your `Cartfile`: ``` -github "socketio/socket.io-client-swift" ~> 2.3.10 # Or latest version +github "socketio/socket.io-client-swift" ~> 2.4.0 # Or latest version ``` Run `carthage update`. @@ -79,7 +79,7 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! -pod 'Socket.IO-Client-Swift', '~> 2.3.10' # Or latest version +pod 'Socket.IO-Client-Swift', '~> 2.4.0' # Or latest version ``` Install pods: diff --git a/Socket.IO-Client-Swift.podspec b/Socket.IO-Client-Swift.podspec index fcfc4fb..5ff6cbe 100644 --- a/Socket.IO-Client-Swift.podspec +++ b/Socket.IO-Client-Swift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Socket.IO-Client-Swift" - s.version = "2.3.10" + s.version = "2.4.0" 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.3.10' } + s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v2.4.0' } s.source_files = "SocketIOClientSwift/**/*.swift" s.requires_arc = true # s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files From e7920062452711093eecfac3864f8a0187b27e86 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 27 Jul 2015 18:50:12 -0400 Subject: [PATCH 4/4] change to default session config --- SocketIOClientSwift/SocketEngine.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SocketIOClientSwift/SocketEngine.swift b/SocketIOClientSwift/SocketEngine.swift index 86f4b5c..f26f050 100644 --- a/SocketIOClientSwift/SocketEngine.swift +++ b/SocketIOClientSwift/SocketEngine.swift @@ -99,7 +99,7 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient { public init(client:SocketEngineClient, sessionDelegate:NSURLSessionDelegate?) { self.client = client - self.session = NSURLSession(configuration: NSURLSessionConfiguration.ephemeralSessionConfiguration(), + self.session = NSURLSession(configuration: NSURLSessionConfiguration.defaultSessionConfiguration(), delegate: sessionDelegate, delegateQueue: workQueue) }