Merge pull request #278 from socketio/standardize-module-name

Standardize module name
This commit is contained in:
Erik Little 2016-01-17 09:29:33 -05:00
commit 609ce08351
12 changed files with 152 additions and 151 deletions

View File

@ -112,13 +112,13 @@ Import the module:
Swift: Swift:
```swift ```swift
import Socket_IO_Client_Swift import SocketIOClientSwift
``` ```
Objective-C: Objective-C:
```Objective-C ```Objective-C
#import <Socket_IO_Client_Swift/Socket_IO_Client_Swift-Swift.h> #import <Socket_IO_Client_Swift/SocketIOClientSwift-Swift.h>
``` ```
CocoaSeeds CocoaSeeds

View File

@ -1,11 +1,12 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift" s.name = "Socket.IO-Client-Swift"
s.module_name = "SocketIOClientSwift"
s.version = "5.1.0" s.version = "5.1.0"
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.
Supports ws/wss/polling connections and binary. Supports ws/wss/polling connections and binary.
For socket.io 1.0+ and Swift 1.2. For socket.io 1.0+ and Swift.
DESC DESC
s.homepage = "https://github.com/socketio/socket.io-client-swift" s.homepage = "https://github.com/socketio/socket.io-client-swift"
s.license = { :type => 'MIT' } s.license = { :type => 'MIT' }

View File

@ -8,9 +8,9 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
572EF21F1B51F16C00EEBB58 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 572EF21F1B51F16C00EEBB58 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
572EF2251B51F16C00EEBB58 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2191B51F16C00EEBB58 /* SocketIO.framework */; }; 572EF2251B51F16C00EEBB58 /* SocketIOClientSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */; };
572EF23D1B51F18A00EEBB58 /* SocketIO-Mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */; settings = {ATTRIBUTES = (Public, ); }; }; 572EF23D1B51F18A00EEBB58 /* SocketIO-Mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */; settings = {ATTRIBUTES = (Public, ); }; };
572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */; }; 572EF2431B51F18A00EEBB58 /* SocketIOClientSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */; };
57634A111BD9B46A00E19CD7 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 57634A111BD9B46A00E19CD7 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
57634A231BD9B46D00E19CD7 /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; }; 57634A231BD9B46D00E19CD7 /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; };
57634A2A1BD9B46D00E19CD7 /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; }; 57634A2A1BD9B46D00E19CD7 /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; };
@ -159,12 +159,12 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
572EF2191B51F16C00EEBB58 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIOClientSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
572EF21D1B51F16C00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 572EF21D1B51F16C00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-iOS.h"; sourceTree = "<group>"; }; 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-iOS.h"; sourceTree = "<group>"; };
572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
572EF22A1B51F16C00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 572EF22A1B51F16C00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF2381B51F18A00EEBB58 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIOClientSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
572EF23B1B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 572EF23B1B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-Mac.h"; sourceTree = "<group>"; }; 572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-Mac.h"; sourceTree = "<group>"; };
572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -213,7 +213,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
572EF2251B51F16C00EEBB58 /* SocketIO.framework in Frameworks */, 572EF2251B51F16C00EEBB58 /* SocketIOClientSwift.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -228,7 +228,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */, 572EF2431B51F18A00EEBB58 /* SocketIOClientSwift.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -265,9 +265,9 @@
572EF21A1B51F16C00EEBB58 /* Products */ = { 572EF21A1B51F16C00EEBB58 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
572EF2191B51F16C00EEBB58 /* SocketIO.framework */, 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */,
572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */, 572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */,
572EF2381B51F18A00EEBB58 /* SocketIO.framework */, 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */,
572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */, 572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */,
57634A161BD9B46A00E19CD7 /* SocketIO.framework */, 57634A161BD9B46A00E19CD7 /* SocketIO.framework */,
57634A3B1BD9B46D00E19CD7 /* SocketIO-tvOSTests.xctest */, 57634A3B1BD9B46D00E19CD7 /* SocketIO-tvOSTests.xctest */,
@ -421,7 +421,7 @@
); );
name = "SocketIO-iOS"; name = "SocketIO-iOS";
productName = "SocketIO-iOS"; productName = "SocketIO-iOS";
productReference = 572EF2191B51F16C00EEBB58 /* SocketIO.framework */; productReference = 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */;
productType = "com.apple.product-type.framework"; productType = "com.apple.product-type.framework";
}; };
572EF2231B51F16C00EEBB58 /* SocketIO-iOSTests */ = { 572EF2231B51F16C00EEBB58 /* SocketIO-iOSTests */ = {
@ -457,7 +457,7 @@
); );
name = "SocketIO-Mac"; name = "SocketIO-Mac";
productName = "SocketIO-Mac"; productName = "SocketIO-Mac";
productReference = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */; productReference = 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */;
productType = "com.apple.product-type.framework"; productType = "com.apple.product-type.framework";
}; };
572EF2411B51F18A00EEBB58 /* SocketIO-MacTests */ = { 572EF2411B51F18A00EEBB58 /* SocketIO-MacTests */ = {
@ -798,7 +798,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10; MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = SocketIO; PRODUCT_NAME = SocketIOClientSwift;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TVOS_DEPLOYMENT_TARGET = 9.0; TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0; WATCHOS_DEPLOYMENT_TARGET = 2.0;
@ -813,7 +813,7 @@
ENABLE_BITCODE = YES; ENABLE_BITCODE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10; MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = SocketIO; PRODUCT_NAME = SocketIOClientSwift;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TVOS_DEPLOYMENT_TARGET = 9.0; TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0; WATCHOS_DEPLOYMENT_TARGET = 2.0;
@ -866,7 +866,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = io.socket.SocketIOClientSwift;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -916,7 +916,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = io.socket.SocketIOClientSwift;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";

View File

@ -15,7 +15,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2371B51F18A00EEBB58" BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
BuildableName = "SocketIO.framework" BuildableName = "SocketIOClientSwift.framework"
BlueprintName = "SocketIO-Mac" BlueprintName = "SocketIO-Mac"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj"> ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference> </BuildableReference>
@ -57,7 +57,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2371B51F18A00EEBB58" BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
BuildableName = "SocketIO.framework" BuildableName = "SocketIOClientSwift.framework"
BlueprintName = "SocketIO-Mac" BlueprintName = "SocketIO-Mac"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj"> ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference> </BuildableReference>
@ -79,7 +79,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2371B51F18A00EEBB58" BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
BuildableName = "SocketIO.framework" BuildableName = "SocketIOClientSwift.framework"
BlueprintName = "SocketIO-Mac" BlueprintName = "SocketIO-Mac"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj"> ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference> </BuildableReference>
@ -97,7 +97,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2371B51F18A00EEBB58" BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
BuildableName = "SocketIO.framework" BuildableName = "SocketIOClientSwift.framework"
BlueprintName = "SocketIO-Mac" BlueprintName = "SocketIO-Mac"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj"> ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference> </BuildableReference>

View File

@ -15,7 +15,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2181B51F16C00EEBB58" BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
BuildableName = "SocketIO.framework" BuildableName = "SocketIOClientSwift.framework"
BlueprintName = "SocketIO-iOS" BlueprintName = "SocketIO-iOS"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj"> ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference> </BuildableReference>
@ -58,7 +58,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2181B51F16C00EEBB58" BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
BuildableName = "SocketIO.framework" BuildableName = "SocketIOClientSwift.framework"
BlueprintName = "SocketIO-iOS" BlueprintName = "SocketIO-iOS"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj"> ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference> </BuildableReference>
@ -80,7 +80,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2181B51F16C00EEBB58" BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
BuildableName = "SocketIO.framework" BuildableName = "SocketIOClientSwift.framework"
BlueprintName = "SocketIO-iOS" BlueprintName = "SocketIO-iOS"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj"> ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference> </BuildableReference>
@ -98,7 +98,7 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2181B51F16C00EEBB58" BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
BuildableName = "SocketIO.framework" BuildableName = "SocketIOClientSwift.framework"
BlueprintName = "SocketIO-iOS" BlueprintName = "SocketIO-iOS"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj"> ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference> </BuildableReference>

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketAckManagerTest: XCTestCase { class SocketAckManagerTest: XCTestCase {
var ackManager = SocketAckManager() var ackManager = SocketAckManager()

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketBasicPacketTest: XCTestCase { class SocketBasicPacketTest: XCTestCase {
let data = "test".dataUsingEncoding(NSUTF8StringEncoding)! let data = "test".dataUsingEncoding(NSUTF8StringEncoding)!

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketEngineTest: XCTestCase { class SocketEngineTest: XCTestCase {
var client: SocketIOClient! var client: SocketIOClient!

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketNamespacePacketTest: XCTestCase { class SocketNamespacePacketTest: XCTestCase {
let data = "test".dataUsingEncoding(NSUTF8StringEncoding)! let data = "test".dataUsingEncoding(NSUTF8StringEncoding)!

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketParserTest: XCTestCase { class SocketParserTest: XCTestCase {
let testSocket = SocketIOClient(socketURL: "") let testSocket = SocketIOClient(socketURL: "")

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketSideEffectTest: XCTestCase { class SocketSideEffectTest: XCTestCase {
let data = "test".dataUsingEncoding(NSUTF8StringEncoding)! let data = "test".dataUsingEncoding(NSUTF8StringEncoding)!

View File

@ -140,36 +140,35 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketParsable
/** /**
Connect to the server. If we aren't connected after timeoutAfter, call handler Connect to the server. If we aren't connected after timeoutAfter, call handler
*/ */
public func connect(timeoutAfter timeoutAfter: Int, public func connect(timeoutAfter timeoutAfter: Int, withTimeoutHandler handler: (() -> Void)?) {
withTimeoutHandler handler: (() -> Void)?) { assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)")
assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)")
guard status != .Connected else { guard status != .Connected else {
DefaultSocketLogger.Logger.log("Tried connecting on an already connected socket", DefaultSocketLogger.Logger.log("Tried connecting on an already connected socket",
type: logType) type: logType)
return return
} }
status = .Connecting status = .Connecting
if engine == nil || forceNew { if engine == nil || forceNew {
addEngine().open(connectParams) addEngine().open(connectParams)
} else { } else {
engine?.open(connectParams) engine?.open(connectParams)
} }
guard timeoutAfter != 0 else { return } guard timeoutAfter != 0 else { return }
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeoutAfter) * Int64(NSEC_PER_SEC)) let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeoutAfter) * Int64(NSEC_PER_SEC))
dispatch_after(time, handleQueue) {[weak self] in dispatch_after(time, handleQueue) {[weak self] in
if let this = self where this.status != .Connected { if let this = self where this.status != .Connected {
this.status = .Closed this.status = .Closed
this.engine?.close("Connect timeout") this.engine?.close("Connect timeout")
handler?() handler?()
}
} }
}
} }
private func createOnAck(items: [AnyObject]) -> OnAckCallback { private func createOnAck(items: [AnyObject]) -> OnAckCallback {
@ -430,7 +429,8 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketParsable
} }
public func parseEngineMessage(msg: String) { public func parseEngineMessage(msg: String) {
DefaultSocketLogger.Logger.log("Should parse message", type: "SocketIOClient") DefaultSocketLogger.Logger.log("Should parse message: %@", type: "SocketIOClient", args: msg)
dispatch_async(parseQueue) { dispatch_async(parseQueue) {
self.parseSocketMessage(msg) self.parseSocketMessage(msg)
} }