Compare commits

...
49 Commits
Author SHA1 Message Date
Erik fba226a6de bump version 2015-07-14 11:42:59 -04:00
Erik 8928ce2693 maybe fix socketio/socket.io-client-swift#100 and socketio/socket.io-client-swift#22 2015-07-12 20:40:41 -04:00
Erik Little ebe9384604 Merge pull request #118 from NachoSoto/remove-handlers
Remove handlers
2015-07-12 20:39:31 -04:00
NachoSoto 5f75e6080b Added SocketIOClient.removeAllHandlers 2015-07-13 00:09:05 +00:00
NachoSoto c40b7c169f Updated BuildableName in schemes 2015-07-13 00:08:56 +00:00
Erik ea0fc9933e bump version 2015-07-12 16:26:02 -04:00
Erik Little 43827914b7 Merge pull request #117 from NachoSoto/master
Added project with iOS and Mac targets => Carthage support
2015-07-12 09:49:40 -04:00
NachoSoto 22b9a1e2f2 Added Carthage instructions to README 2015-07-12 01:06:26 +00:00
NachoSoto fd66a9fa62 Created project with iOS and Mac targets 2015-07-12 00:58:09 +00:00
Erik 998089df91 Invalidate timer on reconnect failure 2015-07-03 13:58:06 -04:00
Erik 283644b75c fix socketio/socket.io-client-swift#110 calling close while trying to reconnect 2015-07-03 13:53:40 -04:00
Erik 846897157c bump version 2015-07-01 07:07:32 -04:00
Erik a49f8f19cf add extraHeaders option fixes. nuclearace/Socket.IO-Client-Swift#64 2015-07-01 07:05:06 -04:00
Erik 531a9784da make it clear as to what language 2015-06-29 18:13:45 -04:00
Erik c34a660cae update readme 2015-06-29 18:12:46 -04:00
Erik 9484bc9614 update readme 2015-06-29 18:11:33 -04:00
Erik d8f65c2804 bump version 2015-06-24 06:52:24 -04:00
Erik ca3f3e810d fix socketio/socket.io-client-swift#97 2015-06-24 06:51:47 -04:00
Erik 63021eb995 bump version 2015-06-23 21:52:05 -04:00
Erik d8e3408565 set connecting 2015-06-23 18:57:37 -04:00
Erik f17575b35c use computed variable for sid 2015-06-16 05:14:32 -04:00
Erik 58571e5387 bump version 2015-06-07 13:15:03 -04:00
Erik 1a54decd51 fix socketio/socket.io-client-swift#93 2015-06-06 22:30:56 -04:00
Erik d982cdc1b2 only do interpolation when logging 2015-06-06 13:15:22 -04:00
Erik 079063e396 bump version 2015-06-05 06:59:20 -04:00
Erik 33d5fd3f10 fix base64 data 2015-06-05 06:57:59 -04:00
Erik 3be5621263 remove comment 2015-05-31 11:09:25 -04:00
Erik 81ab71f519 extract methods 2015-05-31 11:07:48 -04:00
Erik bfeec57c04 don't need type 2015-05-29 10:30:59 -04:00
Erik 0b09a1357c use didset instead of computed variable 2015-05-29 10:29:26 -04:00
Erik e8dfe589ac redo pingtimeouts 2015-05-29 10:10:24 -04:00
Erik fcebc870c3 fix socket.io/socket.io-client-swift#87 2015-05-27 07:28:06 -04:00
Erik eeadccec94 bump version 2015-05-24 08:11:30 -04:00
Erik fa0d5022cf fix socketio/socket.io-client-swift#85 2015-05-24 08:10:43 -04:00
Erik 2fdd1313a8 move open logic to method 2015-05-22 07:26:52 -04:00
Erik 61b4628d3e only use self when needed 2015-05-19 22:13:08 -04:00
Erik 77ed87d0d4 remove dumb comment 2015-05-18 18:43:26 -04:00
Erik a6f68e7b70 tweaks 2015-05-17 08:28:10 -04:00
Erik 2453f33191 bump version 2015-05-14 13:22:54 -04:00
Erik bb3d7fbded add leavenamepsace method, expose joinNamespace 2015-05-14 13:22:25 -04:00
Erik f54153f3d4 fix objc example 2015-05-13 13:40:33 -04:00
Erik 709ecc30b3 tweak ack message 2015-05-13 08:36:08 -04:00
Erik 72dd2ef364 use same example for objc 2015-05-13 08:35:19 -04:00
Erik 9ec521a6de bump version. Changes to connect 2015-05-11 12:40:05 -04:00
Erik 69c67a2b81 Merge branch 'master' into redoconnects 2015-05-11 09:21:03 -04:00
Erik dd068cb480 clarify what nsp does 2015-05-11 09:20:47 -04:00
Erik 3abb26565b tweak closing engine 2015-05-11 09:19:46 -04:00
Erik d7d1da704f document connect method 2015-05-09 15:30:39 -04:00
Erik 5a5dc70203 fix nuclearace/Socket.IO-Client-Swift#46 2015-05-09 15:20:03 -04:00
23 changed files with 1930 additions and 414 deletions

No files matched your search

+18
View File
@@ -23,3 +23,21 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
+35 -10
View File
@@ -19,7 +19,6 @@ socket.on("currentAmount") {data, ack in
}
}
// Connect
socket.connect()
```
@@ -27,12 +26,18 @@ socket.connect()
```objective-c
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8080" options:nil];
[socket on: @"connect" callback: ^(NSArray* data, void (^ack)(NSArray*)) {
NSLog(@"connected");
[socket emit:@"echo" withItems:@[@"echo test"]];
[socket emitWithAck:@"ackack" withItems:@[@1]](10, ^(NSArray* data) {
NSLog(@"Got ack");
[socket on:@"connect" callback:^(NSArray* data, void (^ack)(NSArray*)) {
NSLog(@"socket connected");
}];
[socket on:@"currentAmount" callback:^(NSArray* data, void (^ack)(NSArray*)) {
double cur = [[data objectAtIndex:0] floatValue];
[socket emitWithAck:@"canUpdate" withItems:@[@(cur)]](0, ^(NSArray* data) {
[socket emit:@"update" withItems:@[@{@"amount": @(cur + 2.50)}]];
});
ack(@[@"Got your currentAmount, ", @"dude"]);
}];
[socket connect];
@@ -50,6 +55,16 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8
Requires Swift 1.2/Xcode 6.3
If you need Swift 1.1/Xcode 6.2 use v1.5.2. (Pre-Swift 1.2 support is no longer maintained)
Carthage
-----------------
Add this line to your `Cartfile`:
```
github "socketio/socket.io-client-swift" ~> 2.3.9 # Or latest version
```
Run `carthage update`.
Manually (iOS 7+)
-----------------
1. Copy the SocketIOClientSwift folder into your Xcode project. (Make sure you add the files to your target(s))
@@ -64,7 +79,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Socket.IO-Client-Swift', '~> 1.3.2' # Or latest version
pod 'Socket.IO-Client-Swift', '~> 2.3.9' # Or latest version
```
Install pods:
@@ -73,12 +88,18 @@ Install pods:
$ pod install
```
Import in your swift file:
Import the module:
Swift:
```swift
import Socket_IO_Client_Swift
```
Objective-C:
```Objective-C
#import <Socket_IO_Client_Swift/Socket_IO_Client_Swift-Swift.h>
```
##API
Constructors
-----------
@@ -88,16 +109,18 @@ Constructors
Options
-------
- `connectParams: [String: AnyObject]?` - Dictionary whose contents will be passed with the connection.
- `reconnects: Bool` Default is `true`
- `reconnectAttempts: Int` Default is `-1` (infinite tries)
- `reconnectWait: Int` Default is `10`
- `forcePolling: Bool` Default is `false`. `true` forces the client to use xhr-polling.
- `forceWebsockets: Bool` Default is `false`. `true` forces the client to use WebSockets.
- `nsp: String` Default is `"/"`
- `nsp: String` Default is `"/"`. Connects to a namespace.
- `cookies: [NSHTTPCookie]?` An array of NSHTTPCookies. Passed during the handshake. Default is nil.
- `log: Bool` If `true` socket will log debug messages. Default is false.
- `sessionDelegate: NSURLSessionDelegate` Sets an NSURLSessionDelegate for the underlying engine. Useful if you need to handle self-signed certs. Default is nil.
- `path: String` - If the server uses a custom path. ex: `"/swift"`. Default is `""`
- `extraHeaders: [String: String]?` - Adds custom headers to the initial request. Default is nil.
Methods
-------
@@ -108,9 +131,11 @@ Methods
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.
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. `connectWithParams(params:[String: AnyObject])` - Establishes a connection to the server passing the specified params. 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.
9. `close(#fast:Bool)` - Closes the socket. Once a socket is closed it should not be reopened. Pass true to fast if you're closing from a background task.
10. `reconnect()` - Causes the client to reconnect to the server.
11. `joinNamespace()` - Causes the client to join nsp. Shouldn't need to be called unless you change nsp manually.
12. `leaveNamespace()` - Causes the client to leave the nsp and go back to /
Client Events
------
+2 -2
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift"
s.version = "2.2.3"
s.version = "2.3.9"
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.2.3' }
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v2.3.9' }
s.source_files = "SocketIOClientSwift/**/*.swift"
s.requires_arc = true
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files
@@ -0,0 +1,935 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
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 */; };
572EF22C1B51F16C00EEBB58 /* SocketIO_iOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 572EF22B1B51F16C00EEBB58 /* SocketIO_iOSTests.swift */; };
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 */; };
572EF24A1B51F18A00EEBB58 /* SocketIO_MacTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 572EF2491B51F18A00EEBB58 /* SocketIO_MacTests.swift */; };
5764DF891B51F254004FF46E /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7C1B51F254004FF46E /* SocketAckManager.swift */; };
5764DF8A1B51F254004FF46E /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7C1B51F254004FF46E /* SocketAckManager.swift */; };
5764DF8B1B51F254004FF46E /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7D1B51F254004FF46E /* SocketAnyEvent.swift */; };
5764DF8C1B51F254004FF46E /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7D1B51F254004FF46E /* SocketAnyEvent.swift */; };
5764DF8D1B51F254004FF46E /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7E1B51F254004FF46E /* SocketEngine.swift */; };
5764DF8E1B51F254004FF46E /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7E1B51F254004FF46E /* SocketEngine.swift */; };
5764DF8F1B51F254004FF46E /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7F1B51F254004FF46E /* SocketEngineClient.swift */; };
5764DF901B51F254004FF46E /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7F1B51F254004FF46E /* SocketEngineClient.swift */; };
5764DF911B51F254004FF46E /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF801B51F254004FF46E /* SocketEventHandler.swift */; };
5764DF921B51F254004FF46E /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF801B51F254004FF46E /* SocketEventHandler.swift */; };
5764DF931B51F254004FF46E /* SocketFixUTF8.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF811B51F254004FF46E /* SocketFixUTF8.swift */; };
5764DF941B51F254004FF46E /* SocketFixUTF8.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF811B51F254004FF46E /* SocketFixUTF8.swift */; };
5764DF951B51F254004FF46E /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF821B51F254004FF46E /* SocketIOClient.swift */; };
5764DF961B51F254004FF46E /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF821B51F254004FF46E /* SocketIOClient.swift */; };
5764DF971B51F254004FF46E /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF831B51F254004FF46E /* SocketLogger.swift */; };
5764DF981B51F254004FF46E /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF831B51F254004FF46E /* SocketLogger.swift */; };
5764DF991B51F254004FF46E /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF841B51F254004FF46E /* SocketPacket.swift */; };
5764DF9A1B51F254004FF46E /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF841B51F254004FF46E /* SocketPacket.swift */; };
5764DF9B1B51F254004FF46E /* SocketParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF851B51F254004FF46E /* SocketParser.swift */; };
5764DF9C1B51F254004FF46E /* SocketParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF851B51F254004FF46E /* SocketParser.swift */; };
5764DF9D1B51F254004FF46E /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF861B51F254004FF46E /* SocketTypes.swift */; };
5764DF9E1B51F254004FF46E /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF861B51F254004FF46E /* SocketTypes.swift */; };
5764DF9F1B51F254004FF46E /* SwiftRegex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF871B51F254004FF46E /* SwiftRegex.swift */; };
5764DFA01B51F254004FF46E /* SwiftRegex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF871B51F254004FF46E /* SwiftRegex.swift */; };
5764DFA11B51F254004FF46E /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF881B51F254004FF46E /* WebSocket.swift */; };
5764DFA21B51F254004FF46E /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF881B51F254004FF46E /* WebSocket.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
572EF2261B51F16C00EEBB58 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 572EF20E1B51F12F00EEBB58 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 572EF2181B51F16C00EEBB58;
remoteInfo = "SocketIO-iOS";
};
572EF2441B51F18A00EEBB58 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 572EF20E1B51F12F00EEBB58 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 572EF2371B51F18A00EEBB58;
remoteInfo = "SocketIO-Mac";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
572EF2191B51F16C00EEBB58 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
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>"; };
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>"; };
572EF22B1B51F16C00EEBB58 /* SocketIO_iOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocketIO_iOSTests.swift; sourceTree = "<group>"; };
572EF2381B51F18A00EEBB58 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
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>"; };
572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
572EF2481B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF2491B51F18A00EEBB58 /* SocketIO_MacTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocketIO_MacTests.swift; sourceTree = "<group>"; };
5764DF7C1B51F254004FF46E /* SocketAckManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketAckManager.swift; path = SocketIOClientSwift/SocketAckManager.swift; sourceTree = "<group>"; };
5764DF7D1B51F254004FF46E /* SocketAnyEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketAnyEvent.swift; path = SocketIOClientSwift/SocketAnyEvent.swift; sourceTree = "<group>"; };
5764DF7E1B51F254004FF46E /* SocketEngine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketEngine.swift; path = SocketIOClientSwift/SocketEngine.swift; sourceTree = "<group>"; };
5764DF7F1B51F254004FF46E /* SocketEngineClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketEngineClient.swift; path = SocketIOClientSwift/SocketEngineClient.swift; sourceTree = "<group>"; };
5764DF801B51F254004FF46E /* SocketEventHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketEventHandler.swift; path = SocketIOClientSwift/SocketEventHandler.swift; sourceTree = "<group>"; };
5764DF811B51F254004FF46E /* SocketFixUTF8.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketFixUTF8.swift; path = SocketIOClientSwift/SocketFixUTF8.swift; sourceTree = "<group>"; };
5764DF821B51F254004FF46E /* SocketIOClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketIOClient.swift; path = SocketIOClientSwift/SocketIOClient.swift; sourceTree = "<group>"; };
5764DF831B51F254004FF46E /* SocketLogger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketLogger.swift; path = SocketIOClientSwift/SocketLogger.swift; sourceTree = "<group>"; };
5764DF841B51F254004FF46E /* SocketPacket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketPacket.swift; path = SocketIOClientSwift/SocketPacket.swift; sourceTree = "<group>"; };
5764DF851B51F254004FF46E /* SocketParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketParser.swift; path = SocketIOClientSwift/SocketParser.swift; sourceTree = "<group>"; };
5764DF861B51F254004FF46E /* SocketTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketTypes.swift; path = SocketIOClientSwift/SocketTypes.swift; sourceTree = "<group>"; };
5764DF871B51F254004FF46E /* SwiftRegex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftRegex.swift; path = SocketIOClientSwift/SwiftRegex.swift; sourceTree = "<group>"; };
5764DF881B51F254004FF46E /* WebSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebSocket.swift; path = SocketIOClientSwift/WebSocket.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
572EF2151B51F16C00EEBB58 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF2211B51F16C00EEBB58 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
572EF2251B51F16C00EEBB58 /* SocketIO.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF2341B51F18A00EEBB58 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF23F1B51F18A00EEBB58 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
572EF20D1B51F12F00EEBB58 = {
isa = PBXGroup;
children = (
5764DF7B1B51F24A004FF46E /* Source */,
572EF21B1B51F16C00EEBB58 /* SocketIO-iOS */,
572EF2281B51F16C00EEBB58 /* SocketIO-iOSTests */,
572EF2391B51F18A00EEBB58 /* SocketIO-Mac */,
572EF2461B51F18A00EEBB58 /* SocketIO-MacTests */,
572EF21A1B51F16C00EEBB58 /* Products */,
);
sourceTree = "<group>";
};
572EF21A1B51F16C00EEBB58 /* Products */ = {
isa = PBXGroup;
children = (
572EF2191B51F16C00EEBB58 /* SocketIO.framework */,
572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */,
572EF2381B51F18A00EEBB58 /* SocketIO.framework */,
572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
572EF21B1B51F16C00EEBB58 /* SocketIO-iOS */ = {
isa = PBXGroup;
children = (
572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */,
572EF21C1B51F16C00EEBB58 /* Supporting Files */,
);
path = "SocketIO-iOS";
sourceTree = "<group>";
};
572EF21C1B51F16C00EEBB58 /* Supporting Files */ = {
isa = PBXGroup;
children = (
572EF21D1B51F16C00EEBB58 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
572EF2281B51F16C00EEBB58 /* SocketIO-iOSTests */ = {
isa = PBXGroup;
children = (
572EF22B1B51F16C00EEBB58 /* SocketIO_iOSTests.swift */,
572EF2291B51F16C00EEBB58 /* Supporting Files */,
);
path = "SocketIO-iOSTests";
sourceTree = "<group>";
};
572EF2291B51F16C00EEBB58 /* Supporting Files */ = {
isa = PBXGroup;
children = (
572EF22A1B51F16C00EEBB58 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
572EF2391B51F18A00EEBB58 /* SocketIO-Mac */ = {
isa = PBXGroup;
children = (
572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */,
572EF23A1B51F18A00EEBB58 /* Supporting Files */,
);
path = "SocketIO-Mac";
sourceTree = "<group>";
};
572EF23A1B51F18A00EEBB58 /* Supporting Files */ = {
isa = PBXGroup;
children = (
572EF23B1B51F18A00EEBB58 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
572EF2461B51F18A00EEBB58 /* SocketIO-MacTests */ = {
isa = PBXGroup;
children = (
572EF2491B51F18A00EEBB58 /* SocketIO_MacTests.swift */,
572EF2471B51F18A00EEBB58 /* Supporting Files */,
);
path = "SocketIO-MacTests";
sourceTree = "<group>";
};
572EF2471B51F18A00EEBB58 /* Supporting Files */ = {
isa = PBXGroup;
children = (
572EF2481B51F18A00EEBB58 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
5764DF7B1B51F24A004FF46E /* Source */ = {
isa = PBXGroup;
children = (
5764DF7C1B51F254004FF46E /* SocketAckManager.swift */,
5764DF7D1B51F254004FF46E /* SocketAnyEvent.swift */,
5764DF7E1B51F254004FF46E /* SocketEngine.swift */,
5764DF7F1B51F254004FF46E /* SocketEngineClient.swift */,
5764DF801B51F254004FF46E /* SocketEventHandler.swift */,
5764DF811B51F254004FF46E /* SocketFixUTF8.swift */,
5764DF821B51F254004FF46E /* SocketIOClient.swift */,
5764DF831B51F254004FF46E /* SocketLogger.swift */,
5764DF841B51F254004FF46E /* SocketPacket.swift */,
5764DF851B51F254004FF46E /* SocketParser.swift */,
5764DF861B51F254004FF46E /* SocketTypes.swift */,
5764DF871B51F254004FF46E /* SwiftRegex.swift */,
5764DF881B51F254004FF46E /* WebSocket.swift */,
);
name = Source;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
572EF2161B51F16C00EEBB58 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
572EF21F1B51F16C00EEBB58 /* SocketIO-iOS.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF2351B51F18A00EEBB58 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
572EF23D1B51F18A00EEBB58 /* SocketIO-Mac.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
572EF2181B51F16C00EEBB58 /* SocketIO-iOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 572EF22D1B51F16C00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO-iOS" */;
buildPhases = (
572EF2141B51F16C00EEBB58 /* Sources */,
572EF2151B51F16C00EEBB58 /* Frameworks */,
572EF2161B51F16C00EEBB58 /* Headers */,
572EF2171B51F16C00EEBB58 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "SocketIO-iOS";
productName = "SocketIO-iOS";
productReference = 572EF2191B51F16C00EEBB58 /* SocketIO.framework */;
productType = "com.apple.product-type.framework";
};
572EF2231B51F16C00EEBB58 /* SocketIO-iOSTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 572EF2301B51F16C00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO-iOSTests" */;
buildPhases = (
572EF2201B51F16C00EEBB58 /* Sources */,
572EF2211B51F16C00EEBB58 /* Frameworks */,
572EF2221B51F16C00EEBB58 /* Resources */,
);
buildRules = (
);
dependencies = (
572EF2271B51F16C00EEBB58 /* PBXTargetDependency */,
);
name = "SocketIO-iOSTests";
productName = "SocketIO-iOSTests";
productReference = 572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
572EF2371B51F18A00EEBB58 /* SocketIO-Mac */ = {
isa = PBXNativeTarget;
buildConfigurationList = 572EF24B1B51F18A00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO-Mac" */;
buildPhases = (
572EF2331B51F18A00EEBB58 /* Sources */,
572EF2341B51F18A00EEBB58 /* Frameworks */,
572EF2351B51F18A00EEBB58 /* Headers */,
572EF2361B51F18A00EEBB58 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "SocketIO-Mac";
productName = "SocketIO-Mac";
productReference = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */;
productType = "com.apple.product-type.framework";
};
572EF2411B51F18A00EEBB58 /* SocketIO-MacTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 572EF24E1B51F18A00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO-MacTests" */;
buildPhases = (
572EF23E1B51F18A00EEBB58 /* Sources */,
572EF23F1B51F18A00EEBB58 /* Frameworks */,
572EF2401B51F18A00EEBB58 /* Resources */,
);
buildRules = (
);
dependencies = (
572EF2451B51F18A00EEBB58 /* PBXTargetDependency */,
);
name = "SocketIO-MacTests";
productName = "SocketIO-MacTests";
productReference = 572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
572EF20E1B51F12F00EEBB58 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0640;
TargetAttributes = {
572EF2181B51F16C00EEBB58 = {
CreatedOnToolsVersion = 6.4;
};
572EF2231B51F16C00EEBB58 = {
CreatedOnToolsVersion = 6.4;
};
572EF2371B51F18A00EEBB58 = {
CreatedOnToolsVersion = 6.4;
};
572EF2411B51F18A00EEBB58 = {
CreatedOnToolsVersion = 6.4;
};
};
};
buildConfigurationList = 572EF2111B51F12F00EEBB58 /* Build configuration list for PBXProject "Socket.IO-Client-Swift" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 572EF20D1B51F12F00EEBB58;
productRefGroup = 572EF21A1B51F16C00EEBB58 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
572EF2181B51F16C00EEBB58 /* SocketIO-iOS */,
572EF2231B51F16C00EEBB58 /* SocketIO-iOSTests */,
572EF2371B51F18A00EEBB58 /* SocketIO-Mac */,
572EF2411B51F18A00EEBB58 /* SocketIO-MacTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
572EF2171B51F16C00EEBB58 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF2221B51F16C00EEBB58 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF2361B51F18A00EEBB58 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF2401B51F18A00EEBB58 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
572EF2141B51F16C00EEBB58 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5764DF8D1B51F254004FF46E /* SocketEngine.swift in Sources */,
5764DF9B1B51F254004FF46E /* SocketParser.swift in Sources */,
5764DF9D1B51F254004FF46E /* SocketTypes.swift in Sources */,
5764DF8F1B51F254004FF46E /* SocketEngineClient.swift in Sources */,
5764DF911B51F254004FF46E /* SocketEventHandler.swift in Sources */,
5764DF931B51F254004FF46E /* SocketFixUTF8.swift in Sources */,
5764DF951B51F254004FF46E /* SocketIOClient.swift in Sources */,
5764DF8B1B51F254004FF46E /* SocketAnyEvent.swift in Sources */,
5764DF971B51F254004FF46E /* SocketLogger.swift in Sources */,
5764DFA11B51F254004FF46E /* WebSocket.swift in Sources */,
5764DF991B51F254004FF46E /* SocketPacket.swift in Sources */,
5764DF891B51F254004FF46E /* SocketAckManager.swift in Sources */,
5764DF9F1B51F254004FF46E /* SwiftRegex.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF2201B51F16C00EEBB58 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
572EF22C1B51F16C00EEBB58 /* SocketIO_iOSTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF2331B51F18A00EEBB58 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5764DF8E1B51F254004FF46E /* SocketEngine.swift in Sources */,
5764DF9C1B51F254004FF46E /* SocketParser.swift in Sources */,
5764DF9E1B51F254004FF46E /* SocketTypes.swift in Sources */,
5764DF901B51F254004FF46E /* SocketEngineClient.swift in Sources */,
5764DF921B51F254004FF46E /* SocketEventHandler.swift in Sources */,
5764DF941B51F254004FF46E /* SocketFixUTF8.swift in Sources */,
5764DF961B51F254004FF46E /* SocketIOClient.swift in Sources */,
5764DF8C1B51F254004FF46E /* SocketAnyEvent.swift in Sources */,
5764DF981B51F254004FF46E /* SocketLogger.swift in Sources */,
5764DFA21B51F254004FF46E /* WebSocket.swift in Sources */,
5764DF9A1B51F254004FF46E /* SocketPacket.swift in Sources */,
5764DF8A1B51F254004FF46E /* SocketAckManager.swift in Sources */,
5764DFA01B51F254004FF46E /* SwiftRegex.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
572EF23E1B51F18A00EEBB58 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
572EF24A1B51F18A00EEBB58 /* SocketIO_MacTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
572EF2271B51F16C00EEBB58 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 572EF2181B51F16C00EEBB58 /* SocketIO-iOS */;
targetProxy = 572EF2261B51F16C00EEBB58 /* PBXContainerItemProxy */;
};
572EF2451B51F18A00EEBB58 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 572EF2371B51F18A00EEBB58 /* SocketIO-Mac */;
targetProxy = 572EF2441B51F18A00EEBB58 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
572EF2121B51F12F00EEBB58 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = SocketIO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
572EF2131B51F12F00EEBB58 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = SocketIO;
SWIFT_WHOLE_MODULE_OPTIMIZATION = YES;
};
name = Release;
};
572EF22E1B51F16C00EEBB58 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-iOS/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
572EF22F1B51F16C00EEBB58 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-iOS/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
572EF2311B51F16C00EEBB58 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-iOSTests/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
};
name = Debug;
};
572EF2321B51F16C00EEBB58 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-iOSTests/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
572EF24C1B51F18A00EEBB58 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_VERSION = A;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-Mac/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SKIP_INSTALL = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
572EF24D1B51F18A00EEBB58 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_VERSION = A;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-Mac/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SKIP_INSTALL = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
572EF24F1B51F18A00EEBB58 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-MacTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
};
name = Debug;
};
572EF2501B51F18A00EEBB58 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-MacTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
572EF2111B51F12F00EEBB58 /* Build configuration list for PBXProject "Socket.IO-Client-Swift" */ = {
isa = XCConfigurationList;
buildConfigurations = (
572EF2121B51F12F00EEBB58 /* Debug */,
572EF2131B51F12F00EEBB58 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
572EF22D1B51F16C00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO-iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
572EF22E1B51F16C00EEBB58 /* Debug */,
572EF22F1B51F16C00EEBB58 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
572EF2301B51F16C00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO-iOSTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
572EF2311B51F16C00EEBB58 /* Debug */,
572EF2321B51F16C00EEBB58 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
572EF24B1B51F18A00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO-Mac" */ = {
isa = XCConfigurationList;
buildConfigurations = (
572EF24C1B51F18A00EEBB58 /* Debug */,
572EF24D1B51F18A00EEBB58 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
572EF24E1B51F18A00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO-MacTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
572EF24F1B51F18A00EEBB58 /* Debug */,
572EF2501B51F18A00EEBB58 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 572EF20E1B51F12F00EEBB58 /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Socket.IO-Client-Swift.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
BuildableName = "SocketIO.framework"
BlueprintName = "SocketIO-Mac"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2411B51F18A00EEBB58"
BuildableName = "SocketIO-MacTests.xctest"
BlueprintName = "SocketIO-MacTests"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2411B51F18A00EEBB58"
BuildableName = "SocketIO-MacTests.xctest"
BlueprintName = "SocketIO-MacTests"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
BuildableName = "SocketIO.framework"
BlueprintName = "SocketIO-Mac"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
BuildableName = "SocketIO.framework"
BlueprintName = "SocketIO-Mac"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
BuildableName = "SocketIO.framework"
BlueprintName = "SocketIO-Mac"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
BuildableName = "SocketIO.framework"
BlueprintName = "SocketIO-iOS"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2231B51F16C00EEBB58"
BuildableName = "SocketIO-iOSTests.xctest"
BlueprintName = "SocketIO-iOSTests"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2231B51F16C00EEBB58"
BuildableName = "SocketIO-iOSTests.xctest"
BlueprintName = "SocketIO-iOSTests"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
BuildableName = "SocketIO.framework"
BlueprintName = "SocketIO-iOS"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
BuildableName = "SocketIO.framework"
BlueprintName = "SocketIO-iOS"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
BuildableName = "SocketIO.framework"
BlueprintName = "SocketIO-iOS"
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>io.socket.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
+19
View File
@@ -0,0 +1,19 @@
//
// SocketIO-Mac.h
// SocketIO-Mac
//
// Created by Nacho Soto on 7/11/15.
//
//
#import <Cocoa/Cocoa.h>
//! Project version number for SocketIO-Mac.
FOUNDATION_EXPORT double SocketIO_MacVersionNumber;
//! Project version string for SocketIO-Mac.
FOUNDATION_EXPORT const unsigned char SocketIO_MacVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <SocketIO_Mac/PublicHeader.h>
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>io.socket.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
+36
View File
@@ -0,0 +1,36 @@
//
// SocketIO_MacTests.swift
// SocketIO-MacTests
//
// Created by Nacho Soto on 7/11/15.
//
//
import Cocoa
import XCTest
class SocketIO_MacTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>io.socket.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
+19
View File
@@ -0,0 +1,19 @@
//
// SocketIO-iOS.h
// SocketIO-iOS
//
// Created by Nacho Soto on 7/11/15.
//
//
#import <UIKit/UIKit.h>
//! Project version number for SocketIO-iOS.
FOUNDATION_EXPORT double SocketIO_iOSVersionNumber;
//! Project version string for SocketIO-iOS.
FOUNDATION_EXPORT const unsigned char SocketIO_iOSVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <SocketIO_iOS/PublicHeader.h>
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>io.socket.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
+36
View File
@@ -0,0 +1,36 @@
//
// SocketIO_iOSTests.swift
// SocketIO-iOSTests
//
// Created by Nacho Soto on 7/11/15.
//
//
import UIKit
import XCTest
class SocketIO_iOSTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
+3 -3
View File
@@ -53,11 +53,11 @@ struct SocketAckManager {
private var acks = Set<SocketAck>(minimumCapacity: 1)
mutating func addAck(ack:Int, callback:AckCallback) {
self.acks.insert(SocketAck(ack: ack, callback: callback))
acks.insert(SocketAck(ack: ack, callback: callback))
}
mutating func executeAck(ack:Int, items:[AnyObject]?) {
let callback = self.acks.remove(SocketAck(ack: ack))
let callback = acks.remove(SocketAck(ack: ack))
dispatch_async(dispatch_get_main_queue()) {
callback?.callback(items)
@@ -65,7 +65,7 @@ struct SocketAckManager {
}
mutating func timeoutAck(ack:Int) {
let callback = self.acks.remove(SocketAck(ack: ack))
let callback = acks.remove(SocketAck(ack: ack))
dispatch_async(dispatch_get_main_queue()) {
callback?.callback(["NO ACK"])
+275 -221
View File
@@ -24,16 +24,11 @@
import Foundation
extension String {
private var length:Int {
return count(self)
}
}
public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
private typealias Probe = (msg:String, type:PacketType, data:ContiguousArray<NSData>?)
private typealias ProbeWaitQueue = [Probe]
private let allowedCharacterSet = NSCharacterSet(charactersInString: "!*'();:@&=+$,/?%#[]\" {}").invertedSet
private let workQueue = NSOperationQueue()
private let emitQueue = dispatch_queue_create("engineEmitQueue", DISPATCH_QUEUE_SERIAL)
private let parseQueue = dispatch_queue_create("engineParseQueue", DISPATCH_QUEUE_SERIAL)
@@ -42,10 +37,19 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
private var closed = false
private var _connected = false
private var extraHeaders:[String: String]?
private var fastUpgrade = false
private var forcePolling = false
private var forceWebsockets = false
private var pingInterval:Double?
private var pingTimer:NSTimer?
private var pingTimeout = 0.0 {
didSet {
pongsMissedMax = Int(pingTimeout / (pingInterval ?? 25))
}
}
private var pongsMissed = 0
private var pongsMissedMax = 0
private var postWait = [String]()
private var _polling = true
private var probing = false
@@ -58,21 +62,20 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
let logType = "SocketEngine"
var connected:Bool {
return self._connected
return _connected
}
weak var client:SocketEngineClient?
var cookies:[NSHTTPCookie]?
var log = false
var pingInterval:Int?
var polling:Bool {
return self._polling
return _polling
}
var sid = ""
var socketPath = ""
var urlPolling:String?
var urlWebSocket:String?
var websocket:Bool {
return self._websocket
return _websocket
}
var ws:WebSocket?
@@ -97,16 +100,17 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
public init(client:SocketEngineClient, sessionDelegate:NSURLSessionDelegate?) {
self.client = client
self.session = NSURLSession(configuration: NSURLSessionConfiguration.ephemeralSessionConfiguration(),
delegate: sessionDelegate, delegateQueue: self.workQueue)
delegate: sessionDelegate, delegateQueue: workQueue)
}
public convenience init(client:SocketEngineClient, opts:NSDictionary?) {
self.init(client: client, sessionDelegate: opts?["sessionDelegate"] as? NSURLSessionDelegate)
self.forceWebsockets = opts?["forceWebsockets"] as? Bool ?? false
self.forcePolling = opts?["forcePolling"] as? Bool ?? false
self.cookies = opts?["cookies"] as? [NSHTTPCookie]
self.log = opts?["log"] as? Bool ?? false
self.socketPath = opts?["path"] as? String ?? ""
forceWebsockets = opts?["forceWebsockets"] as? Bool ?? false
forcePolling = opts?["forcePolling"] as? Bool ?? false
cookies = opts?["cookies"] as? [NSHTTPCookie]
log = opts?["log"] as? Bool ?? false
socketPath = opts?["path"] as? String ?? ""
extraHeaders = opts?["extraHeaders"] as? [String: String]
}
deinit {
@@ -114,22 +118,23 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
}
public func close(#fast:Bool) {
SocketLogger.log("Engine is being closed. Fast: \(fast)", client: self)
SocketLogger.log("Engine is being closed. Fast: %@", client: self, args: fast)
self.pingTimer?.invalidate()
self.closed = true
pingTimer?.invalidate()
closed = true
self.write("", withType: PacketType.CLOSE, withData: nil)
self.ws?.disconnect()
self.stopPolling()
ws?.disconnect()
if fast || self.polling {
self.client?.engineDidClose("Disconnect")
if fast || polling {
write("", withType: PacketType.CLOSE, withData: nil)
client?.engineDidClose("Disconnect")
}
stopPolling()
}
private func createBinaryDataForSend(data:NSData) -> (NSData?, String?) {
if self.websocket {
if websocket {
var byteArray = [UInt8](count: 1, repeatedValue: 0x0)
byteArray[0] = 4
var mutData = NSMutableData(bytes: &byteArray, length: 1)
@@ -146,18 +151,18 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
}
}
private func createURLs(params:[String: AnyObject]?) -> (String, String) {
if self.client == nil {
return ("", "")
private func createURLs(params:[String: AnyObject]?) -> (String?, String?) {
if client == nil {
return (nil, nil)
}
let path = self.socketPath == "" ? "/socket.io" : self.socketPath
let path = socketPath == "" ? "/socket.io" : socketPath
var url = "\(self.client!.socketURL)\(path)/?transport="
var url = "\(client!.socketURL)\(path)/?transport="
var urlPolling:String
var urlWebSocket:String
if self.client!.secure {
if client!.secure {
urlPolling = "https://" + url + "polling"
urlWebSocket = "wss://" + url + "websocket"
} else {
@@ -166,7 +171,6 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
}
if params != nil {
let allowedCharacterSet = NSCharacterSet(charactersInString: "!*'();:@&=+$,/?%#[]\" {}").invertedSet
for (key, value) in params! {
let keyEsc = key.stringByAddingPercentEncodingWithAllowedCharacters(
@@ -190,48 +194,63 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
}
private func createWebsocket(andConnect connect:Bool) {
self.ws = WebSocket(url: NSURL(string: self.urlWebSocket! + "&sid=\(self.sid)")!,
cookies: self.cookies)
self.ws?.queue = self.handleQueue
self.ws?.delegate = self
let wsUrl = urlWebSocket! + (sid == "" ? "" : "&sid=\(sid)")
ws = WebSocket(url: NSURL(string: wsUrl)!,
cookies: cookies)
if extraHeaders != nil {
for (headerName, value) in extraHeaders! {
ws?.headers[headerName] = value
}
}
ws?.queue = handleQueue
ws?.delegate = self
if connect {
self.ws?.connect()
ws?.connect()
}
}
private func doFastUpgrade() {
if self.waitingForPoll {
if waitingForPoll {
SocketLogger.err("Outstanding poll when switched to WebSockets," +
"we'll probably disconnect soon. You should report this.", client: self)
}
self.sendWebSocketMessage("", withType: PacketType.UPGRADE, datas: nil)
self._websocket = true
self._polling = false
self.fastUpgrade = false
self.probing = false
self.flushProbeWait()
sendWebSocketMessage("", withType: PacketType.UPGRADE, datas: nil)
_websocket = true
_polling = false
fastUpgrade = false
probing = false
flushProbeWait()
}
private func doPoll() {
if self.websocket || self.waitingForPoll || !self.connected {
if websocket || waitingForPoll || !connected {
return
}
self.waitingForPoll = true
let req = NSMutableURLRequest(URL: NSURL(string: self.urlPolling! + "&sid=\(self.sid)&b64=1")!)
waitingForPoll = true
let req = NSMutableURLRequest(URL: NSURL(string: urlPolling! + "&sid=\(sid)&b64=1")!)
if self.cookies != nil {
let headers = NSHTTPCookie.requestHeaderFieldsWithCookies(self.cookies!)
if cookies != nil {
let headers = NSHTTPCookie.requestHeaderFieldsWithCookies(cookies!)
req.allHTTPHeaderFields = headers
}
self.doRequest(req)
if extraHeaders != nil {
for (headerName, value) in extraHeaders! {
req.setValue(value, forHTTPHeaderField: headerName)
}
}
doRequest(req)
}
private func doRequest(req:NSMutableURLRequest) {
if !self.polling {
if !polling {
return
}
@@ -239,13 +258,13 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
SocketLogger.log("Doing polling request", client: self)
self.session.dataTaskWithRequest(req) {[weak self] data, res, err in
session.dataTaskWithRequest(req) {[weak self] data, res, err in
if let this = self {
if err != nil {
if this.polling {
this.handlePollingFailed(err.localizedDescription)
} else {
NSLog(err.localizedDescription)
SocketLogger.err(err.localizedDescription, client: this)
}
return
}
@@ -262,7 +281,6 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
if this.fastUpgrade {
this.doFastUpgrade()
return
} else if !this.closed && this.polling {
this.doPoll()
}
@@ -272,7 +290,7 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
private func flushProbeWait() {
SocketLogger.log("Flushing probe wait", client: self)
dispatch_async(self.emitQueue) {[weak self] in
dispatch_async(emitQueue) {[weak self] in
if let this = self {
for waiter in this.probeWait {
this.write(waiter.msg, withType: waiter.type, withData: waiter.data)
@@ -288,27 +306,27 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
}
private func flushWaitingForPost() {
if self.postWait.count == 0 || !self.connected {
if postWait.count == 0 || !connected {
return
} else if self.websocket {
self.flushWaitingForPostToWebSocket()
} else if websocket {
flushWaitingForPostToWebSocket()
return
}
var postStr = ""
for packet in self.postWait {
for packet in postWait {
let len = count(packet)
postStr += "\(len):\(packet)"
}
self.postWait.removeAll(keepCapacity: false)
postWait.removeAll(keepCapacity: false)
let req = NSMutableURLRequest(URL: NSURL(string: self.urlPolling! + "&sid=\(self.sid)")!)
let req = NSMutableURLRequest(URL: NSURL(string: urlPolling! + "&sid=\(sid)")!)
if self.cookies != nil {
let headers = NSHTTPCookie.requestHeaderFieldsWithCookies(self.cookies!)
if cookies != nil {
let headers = NSHTTPCookie.requestHeaderFieldsWithCookies(cookies!)
req.allHTTPHeaderFields = headers
}
@@ -321,11 +339,11 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
req.HTTPBody = postData
req.setValue(String(postData.length), forHTTPHeaderField: "Content-Length")
self.waitingForPost = true
waitingForPost = true
SocketLogger.log("POSTing: \(postStr)", client: self)
SocketLogger.log("POSTing: %@", client: self, args: postStr)
self.session.dataTaskWithRequest(req) {[weak self] data, res, err in
session.dataTaskWithRequest(req) {[weak self] data, res, err in
if let this = self {
if err != nil && this.polling {
this.handlePollingFailed(err.localizedDescription)
@@ -349,68 +367,145 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
// We had packets waiting for send when we upgraded
// Send them raw
private func flushWaitingForPostToWebSocket() {
for msg in self.postWait {
self.ws?.writeString(msg)
for msg in postWait {
ws?.writeString(msg)
}
self.postWait.removeAll(keepCapacity: true)
postWait.removeAll(keepCapacity: true)
}
private func handleClose() {
if polling {
client?.engineDidClose("Disconnect")
}
}
private func checkIfMessageIsBase64Binary(var message:String) {
if message.hasPrefix("b4") {
// binary in base64 string
message.removeRange(Range<String.Index>(start: message.startIndex,
end: advance(message.startIndex, 2)))
if let data = NSData(base64EncodedString: message,
options: NSDataBase64DecodingOptions.IgnoreUnknownCharacters), client = client {
dispatch_async(client.handleQueue) {[weak self] in
self?.client?.parseBinaryData(data)
}
}
}
}
private func handleMessage(message:String) {
if let client = client {
dispatch_async(client.handleQueue) {[weak client] in
client?.parseSocketMessage(message)
}
}
}
private func handleNOOP() {
doPoll()
}
private func handleOpen(openData:String) {
var err:NSError?
let mesData = openData.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
if let json = NSJSONSerialization.JSONObjectWithData(mesData,
options: NSJSONReadingOptions.AllowFragments,
error: &err) as? NSDictionary, sid = json["sid"] as? String {
self.sid = sid
_connected = true
if !forcePolling && !forceWebsockets {
createWebsocket(andConnect: true)
}
if let pingInterval = json["pingInterval"] as? Double, pingTimeout = json["pingTimeout"] as? Double {
self.pingInterval = pingInterval / 1000.0
self.pingTimeout = pingTimeout / 1000.0
}
} else {
client?.didError("Engine failed to handshake")
return
}
startPingTimer()
if !forceWebsockets {
doPoll()
}
}
private func handlePong(pongMessage:String) {
pongsMissed = 0
// We should upgrade
if pongMessage == "3probe" {
upgradeTransport()
}
}
// A poll failed, tell the client about it
private func handlePollingFailed(reason:String) {
self._connected = false
self.ws?.disconnect()
self.pingTimer?.invalidate()
self.waitingForPoll = false
self.waitingForPost = false
_connected = false
ws?.disconnect()
pingTimer?.invalidate()
waitingForPoll = false
waitingForPost = false
// If cancelled we were already closing
if self.client == nil || reason == "cancelled" {
if client == nil || reason == "cancelled" {
return
}
if !self.closed {
self.client?.didError(reason)
self.client?.engineDidClose(reason)
if !closed {
client?.didError(reason)
client?.engineDidClose(reason)
}
}
public func open(opts:[String: AnyObject]? = nil) {
if self.connected {
if connected {
SocketLogger.err("Tried to open while connected", client: self)
self.client?.didError("Tried to open while connected")
client?.didError("Tried to open while connected")
return
}
SocketLogger.log("Starting engine", client: self)
SocketLogger.log("Handshaking", client: self)
self.closed = false
let (urlPolling, urlWebSocket) = self.createURLs(opts)
self.urlPolling = urlPolling
self.urlWebSocket = urlWebSocket
closed = false
if self.forceWebsockets {
self._polling = false
self._websocket = true
self.createWebsocket(andConnect: true)
(urlPolling, urlWebSocket) = createURLs(opts)
if forceWebsockets {
_polling = false
_websocket = true
createWebsocket(andConnect: true)
return
}
let reqPolling = NSMutableURLRequest(URL: NSURL(string: urlPolling + "&b64=1")!)
let reqPolling = NSMutableURLRequest(URL: NSURL(string: urlPolling! + "&b64=1")!)
if self.cookies != nil {
let headers = NSHTTPCookie.requestHeaderFieldsWithCookies(self.cookies!)
if cookies != nil {
let headers = NSHTTPCookie.requestHeaderFieldsWithCookies(cookies!)
reqPolling.allHTTPHeaderFields = headers
}
self.doRequest(reqPolling)
if extraHeaders != nil {
for (headerName, value) in extraHeaders! {
reqPolling.setValue(value, forHTTPHeaderField: headerName)
}
}
doRequest(reqPolling)
}
// Translatation of engine.io-parser#decodePayload
private func parsePollingMessage(str:String) {
if str.length == 1 {
if count(str) == 1 {
return
}
@@ -430,31 +525,28 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
}
}
for var i = 0, l = str.length; i < l; i = i &+ 1 {
for var i = 0, l = count(str); i < l; i++ {
let chr = String(strArray[i])
if chr != ":" {
length += chr
} else {
if length == "" || testLength(length, &n) {
SocketLogger.err("Parsing error: \(str)", client: self)
self.handlePollingFailed("Error parsing XHR message")
SocketLogger.err("Parsing error: %@", client: self, args: str)
handlePollingFailed("Error parsing XHR message")
return
}
msg = String(strArray[i&+1...i&+n])
msg = String(strArray[i+1...i+n])
if let lengthInt = length.toInt() {
if lengthInt != msg.length {
SocketLogger.err("parsing error: \(str)", client: self)
return
}
if let lengthInt = length.toInt() where lengthInt != count(msg) {
SocketLogger.err("Parsing error: %@", client: self, args: str)
return
}
if msg.length != 0 {
if count(msg) != 0 {
// Be sure to capture the value of the msg
dispatch_async(self.handleQueue) {[weak self, msg] in
dispatch_async(handleQueue) {[weak self, msg] in
self?.parseEngineMessage(msg, fromPolling: true)
}
}
@@ -466,7 +558,7 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
}
private func parseEngineData(data:NSData) {
if let client = self.client {
if let client = client {
dispatch_async(client.handleQueue) {[weak self] in
self?.client?.parseBinaryData(data.subdataWithRange(NSMakeRange(1, data.length - 1)))
}
@@ -474,121 +566,83 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
}
private func parseEngineMessage(var message:String, fromPolling:Bool) {
SocketLogger.log("Got message: \(message)", client: self)
SocketLogger.log("Got message: %@", client: self, args: message)
if fromPolling {
fixDoubleUTF8(&message)
}
let type = PacketType(str: (message["^(\\d)"].groups()?[1]))
let type = PacketType(str: (message["^(\\d)"].groups()?[1])) ?? {
self.checkIfMessageIsBase64Binary(message)
return PacketType.NOOP
}()
if type == PacketType.MESSAGE {
// Remove message type
switch type {
case PacketType.MESSAGE:
message.removeAtIndex(message.startIndex)
if let client = self.client {
dispatch_async(client.handleQueue) {[weak self] in
self?.client?.parseSocketMessage(message)
}
}
} else if type == PacketType.NOOP {
self.doPoll()
} else if type == PacketType.PONG {
// We should upgrade
if message == "3probe" {
self.upgradeTransport()
}
} else if type == PacketType.OPEN {
var err:NSError?
handleMessage(message)
case PacketType.NOOP:
handleNOOP()
case PacketType.PONG:
handlePong(message)
case PacketType.OPEN:
message.removeAtIndex(message.startIndex)
let mesData = message.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
if let json = NSJSONSerialization.JSONObjectWithData(mesData,
options: NSJSONReadingOptions.AllowFragments,
error: &err) as? NSDictionary, let sid = json["sid"] as? String {
self.sid = sid
self._connected = true
if !self.forcePolling && !self.forceWebsockets {
self.createWebsocket(andConnect: true)
}
if let pingInterval = json["pingInterval"] as? Int {
self.pingInterval = pingInterval / 1000
}
} else {
self.client?.didError("Engine failed to handshake")
return
}
self.startPingTimer()
if !self.forceWebsockets {
self.doPoll()
}
} else if type == PacketType.CLOSE {
if self.client == nil {
return
}
if self.polling {
self.client!.engineDidClose("Disconnect")
}
} else if message.hasPrefix("b4") {
// binary in base64 string
message.removeRange(Range<String.Index>(start: message.startIndex,
end: advance(message.startIndex, 2)))
if let data = NSData(base64EncodedString: message,
options: NSDataBase64DecodingOptions.IgnoreUnknownCharacters), client = self.client {
dispatch_async(client.handleQueue) {[weak self] in
self?.client?.parseBinaryData(data)
}
}
handleOpen(message)
case PacketType.CLOSE:
handleClose()
default:
SocketLogger.log("Got unknown packet type", client: self)
}
}
private func probeWebSocket() {
if self.websocketConnected {
self.sendWebSocketMessage("probe", withType: PacketType.PING)
if websocketConnected {
sendWebSocketMessage("probe", withType: PacketType.PING)
}
}
/// Send an engine message (4)
public func send(msg:String, withData datas:ContiguousArray<NSData>?) {
if self.probing {
self.probeWait.append((msg, PacketType.MESSAGE, datas))
if probing {
probeWait.append((msg, PacketType.MESSAGE, datas))
} else {
self.write(msg, withType: PacketType.MESSAGE, withData: datas)
write(msg, withType: PacketType.MESSAGE, withData: datas)
}
}
func sendPing() {
self.write("", withType: PacketType.PING, withData: nil)
@objc private func sendPing() {
//Server is not responding
if pongsMissed > pongsMissedMax {
pingTimer?.invalidate()
client?.engineDidClose("Ping timeout")
return
}
++pongsMissed
write("", withType: PacketType.PING, withData: nil)
}
/// Send polling message.
/// Only call on emitQueue
private func sendPollMessage(var msg:String, withType type:PacketType,
datas:ContiguousArray<NSData>? = nil) {
SocketLogger.log("Sending poll: \(msg) as type: \(type.rawValue)", client: self)
SocketLogger.log("Sending poll: %@ as type: %@", client: self, args: msg, type.rawValue)
doubleEncodeUTF8(&msg)
let strMsg = "\(type.rawValue)\(msg)"
self.postWait.append(strMsg)
postWait.append(strMsg)
if datas != nil {
for data in datas! {
let (nilData, b64Data) = self.createBinaryDataForSend(data)
let (nilData, b64Data) = createBinaryDataForSend(data)
self.postWait.append(b64Data!)
postWait.append(b64Data!)
}
}
if !self.waitingForPost {
self.flushWaitingForPost()
if !waitingForPost {
flushWaitingForPost()
}
}
@@ -596,15 +650,15 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
/// Only call on emitQueue
private func sendWebSocketMessage(str:String, withType type:PacketType,
datas:ContiguousArray<NSData>? = nil) {
SocketLogger.log("Sending ws: \(str) as type: \(type.rawValue)", client: self)
SocketLogger.log("Sending ws: %@ as type: %@", client: self, args: str, type.rawValue)
self.ws?.writeString("\(type.rawValue)\(str)")
ws?.writeString("\(type.rawValue)\(str)")
if datas != nil {
for data in datas! {
let (data, nilString) = self.createBinaryDataForSend(data)
let (data, nilString) = createBinaryDataForSend(data)
if data != nil {
self.ws?.writeData(data!)
ws?.writeData(data!)
}
}
}
@@ -612,32 +666,30 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
// Starts the ping timer
private func startPingTimer() {
if self.pingInterval == nil {
if pingInterval == nil {
return
}
self.pingTimer?.invalidate()
pingTimer?.invalidate()
dispatch_async(dispatch_get_main_queue()) {[weak self] in
if let this = self {
this.pingTimer = NSTimer.scheduledTimerWithTimeInterval(NSTimeInterval(this.pingInterval!),
target: this,
this.pingTimer = NSTimer.scheduledTimerWithTimeInterval(this.pingInterval!, target: this,
selector: Selector("sendPing"), userInfo: nil, repeats: true)
}
}
}
func stopPolling() {
self.session.invalidateAndCancel()
session.invalidateAndCancel()
}
private func upgradeTransport() {
if self.websocketConnected {
if websocketConnected {
SocketLogger.log("Upgrading transport to WebSockets", client: self)
// Do a fast upgrade
// At this point, we should not send anymore polling messages-
self.fastUpgrade = true
self.sendPollMessage("", withType: PacketType.NOOP)
fastUpgrade = true
sendPollMessage("", withType: PacketType.NOOP)
// After this point, we should not send anymore polling messages
}
}
@@ -645,13 +697,15 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
Write a message, independent of transport.
*/
public func write(msg:String, withType type:PacketType, withData data:ContiguousArray<NSData>?) {
dispatch_async(self.emitQueue) {[weak self] in
dispatch_async(emitQueue) {[weak self] in
if let this = self where this.connected {
if this.websocket {
SocketLogger.log("Writing ws: \(msg):\(data)", client: this)
SocketLogger.log("Writing ws: %@ has data: %@", client: this,
args: msg, data == nil ? false : true)
this.sendWebSocketMessage(msg, withType: type, datas: data)
} else {
SocketLogger.log("Writing poll: \(msg):\(data)", client: this)
SocketLogger.log("Writing poll: %@ has data: %@", client: this,
args: msg, data == nil ? false : true)
this.sendPollMessage(msg, withType: type, datas: data)
}
}
@@ -671,56 +725,56 @@ public final class SocketEngine: NSObject, WebSocketDelegate, SocketLogClient {
}
}
self.write(msg, withType: pType, withData: arr)
write(msg, withType: pType, withData: arr)
}
}
// Delagate methods
public func websocketDidConnect(socket:WebSocket) {
self.websocketConnected = true
websocketConnected = true
if !self.forceWebsockets {
self.probing = true
self.probeWebSocket()
if !forceWebsockets {
probing = true
probeWebSocket()
} else {
self._connected = true
self.probing = false
self._polling = false
_connected = true
probing = false
_polling = false
}
}
public func websocketDidDisconnect(socket:WebSocket, error:NSError?) {
self.websocketConnected = false
self.probing = false
websocketConnected = false
probing = false
if self.closed {
self.client?.engineDidClose("Disconnect")
if closed {
client?.engineDidClose("Disconnect")
return
}
if self.websocket {
self.pingTimer?.invalidate()
self._connected = false
self._websocket = false
if websocket {
pingTimer?.invalidate()
_connected = false
_websocket = false
let reason = error?.localizedDescription ?? "Socket Disconnected"
if error != nil {
self.client?.didError(reason)
client?.didError(reason)
}
self.client?.engineDidClose(reason)
client?.engineDidClose(reason)
} else {
self.flushProbeWait()
flushProbeWait()
}
}
public func websocketDidReceiveMessage(socket:WebSocket, text:String) {
self.parseEngineMessage(text, fromPolling: false)
parseEngineMessage(text, fromPolling: false)
}
public func websocketDidReceiveData(socket:WebSocket, data:NSData) {
self.parseEngineData(data)
parseEngineData(data)
}
}
@@ -27,7 +27,6 @@ import Foundation
@objc public protocol SocketEngineClient {
var handleQueue:dispatch_queue_attr_t! {get}
var emitQueue:dispatch_queue_attr_t! {get}
var socketURL:String {get}
var secure:Bool {get}
@@ -25,7 +25,6 @@
import Foundation
private func emitAckCallback(socket:SocketIOClient, num:Int)
// Curried
(items:AnyObject...) -> Void {
socket.emitAck(num, withData: items)
}
+149 -120
View File
@@ -25,16 +25,14 @@
import Foundation
public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient {
private lazy var params = [String: AnyObject]()
private var anyHandler:((SocketAnyEvent) -> Void)?
private var _closed = false
private var _connected = false
private var _connecting = false
private var currentReconnectAttempt = 0
private var handlers = ContiguousArray<SocketEventHandler>()
private var paramConnect = false
private var connectParams:[String: AnyObject]?
private var _secure = false
private var _sid:String?
private var _reconnecting = false
private var reconnectTimer:NSTimer?
@@ -51,27 +49,27 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
public let handleQueue = dispatch_queue_create("handleQueue", DISPATCH_QUEUE_SERIAL)
public let emitQueue = dispatch_queue_create("emitQueue", DISPATCH_QUEUE_SERIAL)
public var closed:Bool {
return self._closed
return _closed
}
public var connected:Bool {
return self._connected
return _connected
}
public var connecting:Bool {
return self._connecting
return _connecting
}
public var engine:SocketEngine?
public var nsp = "/"
public var opts:[String: AnyObject]?
public var reconnects = true
public var reconnecting:Bool {
return self._reconnecting
return _reconnecting
}
public var reconnectWait = 10
public var secure:Bool {
return self._secure
return _secure
}
public var sid:String? {
return self._sid
return engine?.sid
}
/**
@@ -93,6 +91,10 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
self.sessionDelegate = sessionDelegate
}
if let connectParams = opts?["connectParams"] as? [String: AnyObject] {
self.connectParams = connectParams
}
if let log = opts?["log"] as? Bool {
self.log = log
}
@@ -128,12 +130,18 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
deinit {
SocketLogger.log("Client is being deinit", client: self)
engine?.close(fast: true)
}
private func addEngine() {
SocketLogger.log("Adding engine", client: self)
self.engine = SocketEngine(client: self, opts: self.opts)
engine = SocketEngine(client: self, opts: opts)
}
private func clearReconnectTimer() {
reconnectTimer?.invalidate()
reconnectTimer = nil
}
/**
@@ -144,53 +152,55 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
public func close(#fast:Bool) {
SocketLogger.log("Closing socket", client: self)
self.reconnects = false
self._connecting = false
self._connected = false
self._reconnecting = false
self.engine?.close(fast: fast)
self.engine = nil
reconnects = false
_connecting = false
_connected = false
_reconnecting = false
engine?.close(fast: fast)
engine = nil
}
/**
Connect to the server.
*/
public func connect() {
if self.closed {
println("Warning! This socket was previously closed. This might be dangerous!")
self._closed = false
}
if self.connected {
return
}
self.addEngine()
self.engine?.open()
connect(timeoutAfter: 0, withTimeoutHandler: nil)
}
/**
Connect to the server with params that will be passed on connection.
Connect to the server. If we aren't connected after timeoutAfter, call handler
*/
public func connectWithParams(params:[String: AnyObject]) {
if self.closed {
println("Warning! This socket was previously closed. This might be dangerous!")
self._closed = false
}
if self.connected {
public func connect(#timeoutAfter:Int, withTimeoutHandler handler:(() -> Void)?) {
if closed {
SocketLogger.log("Warning! This socket was previously closed. This might be dangerous!", client: self)
_closed = false
} else if connected {
return
}
self.params = params
self.paramConnect = true
_connecting = true
addEngine()
engine?.open(opts: connectParams)
self.addEngine()
self.engine?.open(opts: params)
if timeoutAfter == 0 {
return
}
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeoutAfter) * Int64(NSEC_PER_SEC))
dispatch_after(time, dispatch_get_main_queue()) {[weak self] in
if let this = self where !this.connected {
this._closed = true
this._connecting = false
this.engine?.close(fast: true)
handler?()
}
}
}
private func createOnAck(event:String, items:[AnyObject]) -> OnAckCallback {
return {[weak self, ack = ++self.currentAck] timeout, callback in
return {[weak self, ack = ++currentAck] timeout, callback in
if let this = self {
this.ackHandlers.addAck(ack, callback: callback)
@@ -212,43 +222,41 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
func didConnect() {
SocketLogger.log("Socket connected", client: self)
self._closed = false
self._connected = true
self._connecting = false
self._reconnecting = false
self.currentReconnectAttempt = 0
self.reconnectTimer?.invalidate()
self.reconnectTimer = nil
self._sid = self.engine?.sid
_closed = false
_connected = true
_connecting = false
_reconnecting = false
currentReconnectAttempt = 0
clearReconnectTimer()
// Don't handle as internal because something crazy could happen where
// we disconnect before it's handled
self.handleEvent("connect", data: nil, isInternalMessage: false)
handleEvent("connect", data: nil, isInternalMessage: false)
}
func didDisconnect(reason:String) {
if self.closed {
if closed {
return
}
SocketLogger.log("Disconnected: \(reason)", client: self)
SocketLogger.log("Disconnected: %@", client: self, args: reason)
self._closed = true
self._connected = false
self.reconnects = false
self._connecting = false
self._reconnecting = false
_closed = true
_connected = false
reconnects = false
_connecting = false
_reconnecting = false
// Make sure the engine is actually dead.
self.engine?.close(fast: true)
self.handleEvent("disconnect", data: [reason], isInternalMessage: true)
engine?.close(fast: true)
handleEvent("disconnect", data: [reason], isInternalMessage: true)
}
/// error
public func didError(reason:AnyObject) {
SocketLogger.err("Error: \(reason)", client: self)
SocketLogger.err("%@", client: self, args: reason)
self.handleEvent("error", data: reason as? [AnyObject] ?? [reason],
handleEvent("error", data: reason as? [AnyObject] ?? [reason],
isInternalMessage: true)
}
@@ -256,18 +264,18 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
Same as close
*/
public func disconnect(#fast:Bool) {
self.close(fast: fast)
close(fast: fast)
}
/**
Send a message to the server
*/
public func emit(event:String, _ items:AnyObject...) {
if !self.connected {
if !connected {
return
}
dispatch_async(self.emitQueue) {[weak self] in
dispatch_async(emitQueue) {[weak self] in
self?._emit(event, items)
}
}
@@ -276,11 +284,11 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
Same as emit, but meant for Objective-C
*/
public func emit(event:String, withItems items:[AnyObject]) {
if !self.connected {
if !connected {
return
}
dispatch_async(self.emitQueue) {[weak self] in
dispatch_async(emitQueue) {[weak self] in
self?._emit(event, items)
}
}
@@ -290,47 +298,47 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
an ack.
*/
public func emitWithAck(event:String, _ items:AnyObject...) -> OnAckCallback {
if !self.connected {
if !connected {
return createOnAck(event, items: items)
}
return self.createOnAck(event, items: items)
return createOnAck(event, items: items)
}
/**
Same as emitWithAck, but for Objective-C
*/
public func emitWithAck(event:String, withItems items:[AnyObject]) -> OnAckCallback {
if !self.connected {
return self.createOnAck(event, items: items)
if !connected {
return createOnAck(event, items: items)
}
return self.createOnAck(event, items: items)
return createOnAck(event, items: items)
}
private func _emit(event:String, _ args:[AnyObject], ack:Int? = nil) {
if !self.connected {
if !connected {
return
}
let packet = SocketPacket(type: nil, data: args, nsp: self.nsp, id: ack)
let packet = SocketPacket(type: nil, data: args, nsp: nsp, id: ack)
let str:String
SocketParser.parseForEmit(packet)
str = packet.createMessageForEvent(event)
SocketLogger.log("Emitting: \(str)", client: self)
SocketLogger.log("Emitting: %@", client: self, args: str)
if packet.type == SocketPacket.PacketType.BINARY_EVENT {
self.engine?.send(str, withData: packet.binary)
engine?.send(str, withData: packet.binary)
} else {
self.engine?.send(str, withData: nil)
engine?.send(str, withData: nil)
}
}
// If the server wants to know that the client received data
func emitAck(ack:Int, withData args:[AnyObject]) {
dispatch_async(self.emitQueue) {[weak self] in
dispatch_async(emitQueue) {[weak self] in
if let this = self where this.connected {
let packet = SocketPacket(type: nil, data: args, nsp: this.nsp, id: ack)
let str:String
@@ -338,7 +346,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
SocketParser.parseForEmit(packet)
str = packet.createAck()
SocketLogger.log("Emitting Ack: \(str)", client: this)
SocketLogger.log("Emitting Ack: %@", client: this, args: str)
if packet.type == SocketPacket.PacketType.BINARY_ACK {
this.engine?.send(str, withData: packet.binary)
@@ -351,22 +359,23 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
}
public func engineDidClose(reason:String) {
self._connected = false
self._connecting = false
_connected = false
_connecting = false
if self.closed || !self.reconnects {
self.didDisconnect("Engine closed")
} else if !self.reconnecting {
self.handleEvent("reconnect", data: [reason], isInternalMessage: true)
self.tryReconnect()
if closed || !reconnects {
didDisconnect(reason)
} else if !reconnecting {
handleEvent("reconnect", data: [reason], isInternalMessage: true)
tryReconnect()
}
}
// Called when the socket gets an ack for something it sent
func handleAck(ack:Int, data:AnyObject?) {
SocketLogger.log("Handling ack: \(ack) with data: \(data)", client: self)
SocketLogger.log("Handling ack: %@ with data: %@", client: self,
args: ack, data ?? "")
self.ackHandlers.executeAck(ack,
ackHandlers.executeAck(ack,
items: (data as? [AnyObject]?) ?? (data != nil ? [data!] : nil))
}
@@ -376,19 +385,20 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
public func handleEvent(event:String, data:[AnyObject]?, isInternalMessage:Bool = false,
wantsAck ack:Int? = nil) {
// println("Should do event: \(event) with data: \(data)")
if !self.connected && !isInternalMessage {
if !connected && !isInternalMessage {
return
}
SocketLogger.log("Handling event: \(event) with data: \(data)", client: self)
SocketLogger.log("Handling event: %@ with data: %@", client: self,
args: event, data ?? "")
if self.anyHandler != nil {
if anyHandler != nil {
dispatch_async(dispatch_get_main_queue()) {[weak self] in
self?.anyHandler?(SocketAnyEvent(event: event, items: data))
}
}
for handler in self.handlers {
for handler in handlers {
if handler.event == event {
if ack != nil {
handler.executeCallback(data, withAck: ack!, withSocket: self)
@@ -399,11 +409,24 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
}
}
func joinNamespace() {
/**
Leaves nsp and goes back to /
*/
public func leaveNamespace() {
if nsp != "/" {
engine?.send("1/\(nsp)", withData: nil)
nsp = "/"
}
}
/**
Joins nsp if it is not /
*/
public func joinNamespace() {
SocketLogger.log("Joining namespace", client: self)
if self.nsp != "/" {
self.engine?.send("0/\(self.nsp)", withData: nil)
if nsp != "/" {
engine?.send("0/\(nsp)", withData: nil)
}
}
@@ -411,33 +434,41 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
Removes handler(s)
*/
public func off(event:String) {
SocketLogger.log("Removing handler for event: \(event)", client: self)
SocketLogger.log("Removing handler for event: %@", client: self, args: event)
self.handlers = self.handlers.filter {$0.event == event ? false : true}
handlers = handlers.filter {$0.event == event ? false : true}
}
/**
Adds a handler for an event.
*/
public func on(name:String, callback:NormalCallback) {
SocketLogger.log("Adding handler for event: \(name)", client: self)
public func on(event:String, callback:NormalCallback) {
SocketLogger.log("Adding handler for event: %@", client: self, args: event)
let handler = SocketEventHandler(event: name, callback: callback)
self.handlers.append(handler)
let handler = SocketEventHandler(event: event, callback: callback)
handlers.append(handler)
}
/**
Removes all handlers.
Can be used after disconnecting to break any potential remaining retain cycles.
*/
public func removeAllHandlers() {
handlers.removeAll(keepCapacity: false)
}
/**
Adds a handler that will be called on every event.
*/
public func onAny(handler:(SocketAnyEvent) -> Void) {
self.anyHandler = handler
anyHandler = handler
}
/**
Same as connect
*/
public func open() {
self.connect()
connect()
}
public func parseSocketMessage(msg:String) {
@@ -452,29 +483,31 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
Trieds to reconnect to the server.
*/
public func reconnect() {
self._connected = false
self._connecting = false
self._reconnecting = false
_connected = false
_connecting = false
_reconnecting = false
self.engine?.stopPolling()
self.tryReconnect()
engine?.stopPolling()
tryReconnect()
}
// We lost connection and should attempt to reestablish
@objc private func tryReconnect() {
if self.reconnectAttempts != -1 && self.currentReconnectAttempt + 1 > self.reconnectAttempts {
self.didDisconnect("Reconnect Failed")
if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts || !reconnects {
clearReconnectTimer()
didDisconnect("Reconnect Failed")
return
} else if self.connected {
self._connecting = false
self._reconnecting = false
} else if connected {
_connecting = false
_reconnecting = false
return
}
if self.reconnectTimer == nil {
if reconnectTimer == nil {
SocketLogger.log("Starting reconnect", client: self)
self._reconnecting = true
_reconnecting = true
dispatch_async(dispatch_get_main_queue()) {[weak self] in
if let this = self {
@@ -485,14 +518,10 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
}
SocketLogger.log("Trying to reconnect", client: self)
self.handleEvent("reconnectAttempt", data: [self.reconnectAttempts - self.currentReconnectAttempt],
handleEvent("reconnectAttempt", data: [reconnectAttempts - currentReconnectAttempt],
isInternalMessage: true)
self.currentReconnectAttempt++
if self.paramConnect {
self.connectWithParams(self.params)
} else {
self.connect()
}
currentReconnectAttempt++
connect()
}
}
+24 -4
View File
@@ -24,6 +24,8 @@
import Foundation
private let MESSAGE_LENGTH_MAX = 10000
protocol SocketLogClient {
var log:Bool {get set}
var logType:String {get}
@@ -32,23 +34,41 @@ protocol SocketLogClient {
final class SocketLogger {
private static let printQueue = dispatch_queue_create("printQueue", DISPATCH_QUEUE_SERIAL)
static func log(message:String, client:SocketLogClient, altType:String? = nil) {
private static func shorten(item:AnyObject) -> CVarArgType {
var str = toString(item)
if count(str) > MESSAGE_LENGTH_MAX {
let endIndex = advance(str.startIndex, MESSAGE_LENGTH_MAX)
str = str.substringToIndex(endIndex)
}
return str
}
static func log(message:String, client:SocketLogClient, altType:String? = nil, args:AnyObject...) {
if !client.log {
return
}
dispatch_async(printQueue) {[type = client.logType] in
NSLog("%@: %@", altType ?? type, message)
let newArgs = args.map(SocketLogger.shorten)
let replaced = String(format: message, arguments: newArgs)
NSLog("%@: %@", altType ?? type, replaced)
}
}
static func err(message:String, client:SocketLogClient, altType:String? = nil) {
static func err(message:String, client:SocketLogClient, altType:String? = nil, args:AnyObject...) {
if !client.log {
return
}
dispatch_async(printQueue) {[type = client.logType] in
NSLog("ERROR %@: %@", altType ?? type, message)
let newArgs = args.map(SocketLogger.shorten)
let replaced = String(format: message, arguments: newArgs)
NSLog("ERROR %@: %@", altType ?? type, replaced)
}
}
}
+49 -46
View File
@@ -32,10 +32,10 @@ final class SocketPacket: Printable {
var better = "SocketPacket {type: ~~0; data: ~~1; " +
"id: ~~2; placeholders: ~~3;}"
better = better["~~0"] ~= (self.type != nil ? String(self.type!.rawValue) : "nil")
better = better["~~1"] ~= (self.data != nil ? "\(self.data!)" : "nil")
better = better["~~2"] ~= (self.id != nil ? String(self.id!) : "nil")
better = better["~~3"] ~= (self.placeholders != nil ? String(self.placeholders!) : "nil")
better = better["~~0"] ~= (type != nil ? String(type!.rawValue) : "nil")
better = better["~~1"] ~= (data != nil ? "\(data!)" : "nil")
better = better["~~2"] ~= (id != nil ? String(id!) : "nil")
better = better["~~3"] ~= (placeholders != nil ? String(placeholders!) : "nil")
return better
}
@@ -77,15 +77,15 @@ final class SocketPacket: Printable {
}
func addData(data:NSData) -> Bool {
if self.placeholders == self.currentPlace {
if placeholders == currentPlace {
return true
}
self.binary.append(data)
self.currentPlace++
binary.append(data)
currentPlace++
if self.placeholders == self.currentPlace {
self.currentPlace = 0
if placeholders == currentPlace {
currentPlace = 0
return true
} else {
return false
@@ -95,85 +95,88 @@ final class SocketPacket: Printable {
func createMessageForEvent(event:String) -> String {
let message:String
if self.binary.count == 0 {
self.type = PacketType.EVENT
if binary.count == 0 {
type = PacketType.EVENT
if self.nsp == "/" {
if self.id == nil {
if nsp == "/" {
if id == nil {
message = "2[\"\(event)\""
} else {
message = "2\(self.id!)[\"\(event)\""
message = "2\(id!)[\"\(event)\""
}
} else {
if self.id == nil {
message = "2/\(self.nsp),[\"\(event)\""
if id == nil {
message = "2/\(nsp),[\"\(event)\""
} else {
message = "2/\(self.nsp),\(self.id!)[\"\(event)\""
message = "2/\(nsp),\(id!)[\"\(event)\""
}
}
} else {
self.type = PacketType.BINARY_EVENT
type = PacketType.BINARY_EVENT
if self.nsp == "/" {
if self.id == nil {
message = "5\(self.binary.count)-[\"\(event)\""
if nsp == "/" {
if id == nil {
message = "5\(binary.count)-[\"\(event)\""
} else {
message = "5\(self.binary.count)-\(self.id!)[\"\(event)\""
message = "5\(binary.count)-\(id!)[\"\(event)\""
}
} else {
if self.id == nil {
message = "5\(self.binary.count)-/\(self.nsp),[\"\(event)\""
if id == nil {
message = "5\(binary.count)-/\(nsp),[\"\(event)\""
} else {
message = "5\(self.binary.count)-/\(self.nsp),\(self.id!)[\"\(event)\""
message = "5\(binary.count)-/\(nsp),\(id!)[\"\(event)\""
}
}
}
return self.completeMessage(message)
return completeMessage(message)
}
func createAck() -> String {
var msg:String
if self.binary.count == 0 {
self.type = PacketType.ACK
if binary.count == 0 {
type = PacketType.ACK
if nsp == "/" {
msg = "3\(self.id!)["
msg = "3\(id!)["
} else {
msg = "3/\(self.nsp),\(self.id!)["
msg = "3/\(nsp),\(id!)["
}
} else {
self.type = PacketType.BINARY_ACK
type = PacketType.BINARY_ACK
if nsp == "/" {
msg = "6\(self.binary.count)-\(self.id!)["
msg = "6\(binary.count)-\(id!)["
} else {
msg = "6\(self.binary.count)-/\(self.nsp),\(self.id!)["
msg = "6\(binary.count)-/\(nsp),\(id!)["
}
}
return self.completeMessage(msg, ack: true)
return completeMessage(msg, ack: true)
}
private func completeMessage(var message:String, ack:Bool = false) -> String {
var err:NSError?
if self.data == nil || self.data!.count == 0 {
if data == nil || data!.count == 0 {
return message + "]"
} else if !ack {
message += ","
}
for arg in self.data! {
for arg in data! {
if arg is NSDictionary || arg is [AnyObject] {
let jsonSend = NSJSONSerialization.dataWithJSONObject(arg,
options: NSJSONWritingOptions(0), error: &err)
let jsonString = NSString(data: jsonSend!, encoding: NSUTF8StringEncoding)
message += jsonString! as String + ","
} else if arg is String {
message += "\"\(arg)\","
} else if var str = arg as? String {
str = str["\n"] ~= "\\\\n"
str = str["\r"] ~= "\\\\r"
message += "\"\(str)\","
} else if arg is NSNull {
message += "null,"
} else {
@@ -189,23 +192,23 @@ final class SocketPacket: Printable {
}
func fillInPlaceholders() {
var newArr = NSMutableArray(array: self.data!)
var newArr = NSMutableArray(array: data!)
for i in 0..<self.data!.count {
if let str = self.data?[i] as? String, num = str["~~(\\d)"].groups() {
newArr[i] = self.binary[num[1].toInt()!]
} else if self.data?[i] is NSDictionary || self.data?[i] is NSArray {
newArr[i] = self._fillInPlaceholders(self.data![i])
for i in 0..<data!.count {
if let str = data?[i] as? String, num = str["~~(\\d)"].groups() {
newArr[i] = binary[num[1].toInt()!]
} else if data?[i] is NSDictionary || data?[i] is NSArray {
newArr[i] = _fillInPlaceholders(data![i])
}
}
self.data = newArr as [AnyObject]
data = newArr as [AnyObject]
}
private func _fillInPlaceholders(data:AnyObject) -> AnyObject {
if let str = data as? String {
if let num = str["~~(\\d)"].groups() {
return self.binary[num[1].toInt()!]
return binary[num[1].toInt()!]
} else {
return str
}
+3 -6
View File
@@ -145,7 +145,7 @@ class SocketParser {
}
if ++i < arr.count {
let d = String(arr[i...arr.count-1])
let d = str[advance(str.startIndex, i)...advance(str.startIndex, count(str)-1)]
let noPlaceholders = d["(\\{\"_placeholder\":true,\"num\":(\\d*)\\})"] ~= "\"~~$2\""
let data = SocketParser.parseData(noPlaceholders) as? [AnyObject] ?? [noPlaceholders]
@@ -185,7 +185,7 @@ class SocketParser {
return nsp == "" && socket.nsp != "/"
}
SocketLogger.log("Parsing \(stringMessage)", client: socket, altType: "SocketParser")
SocketLogger.log("Parsing %@", client: socket, altType: "SocketParser", args: stringMessage)
let p:SocketPacket
@@ -196,10 +196,7 @@ class SocketParser {
return
}
// Don't call SocketPacket.description unless we need to
if socket.log {
SocketLogger.log("Decoded packet as: \(p)", client: socket, altType: "SocketParser")
}
SocketLogger.log("Decoded packet as: %@", client: socket, altType: "SocketParser", args: p)
if p.type == SocketPacket.PacketType.EVENT {
if checkNSP(p.nsp) {