Merge branch 'development'

* development:
  update readme
  Renamed modules to make then consistent.
  rename engine init
  tweaks
  Add SocketIOClientConfiguration
  Rename variable
  refactor some reconnect code
  bump websocket version
  move extensions
  refactor out checking for base64
This commit is contained in:
Erik 2016-08-27 11:08:30 -04:00
commit 2910355245
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D
19 changed files with 461 additions and 318 deletions

View File

@ -5,7 +5,9 @@ Socket.IO-client for iOS/OS X.
##Example ##Example
```swift ```swift
let socket = SocketIOClient(socketURL: NSURL(string: "http://localhost:8080")!, options: [.Log(true), .ForcePolling(true)]) import SocketIO
let socket = SocketIOClient(socketURL: NSURL(string: "http://localhost:8080")!, config: [.Log(true), .ForcePolling(true)])
socket.on("connect") {data, ack in socket.on("connect") {data, ack in
print("socket connected") print("socket connected")
@ -26,8 +28,9 @@ socket.connect()
##Objective-C Example ##Objective-C Example
```objective-c ```objective-c
@import SocketIO;
NSURL* url = [[NSURL alloc] initWithString:@"http://localhost:8080"]; NSURL* url = [[NSURL alloc] initWithString:@"http://localhost:8080"];
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url options:@{@"log": @YES, @"forcePolling": @YES}]; SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{@"log": @YES, @"forcePolling": @YES}];
[socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) { [socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
NSLog(@"socket connected"); NSLog(@"socket connected");
@ -115,13 +118,13 @@ Import the module:
Swift: Swift:
```swift ```swift
import SocketIOClientSwift import SocketIO
``` ```
Objective-C: Objective-C:
```Objective-C ```Objective-C
@import SocketIOClientSwift; @import SocketIO;
``` ```
CocoaSeeds CocoaSeeds
@ -139,7 +142,7 @@ Run `seed install`.
##API ##API
Constructors Constructors
----------- -----------
`init(var socketURL: NSURL, options: Set<SocketIOClientOption> = [])` - Creates a new SocketIOClient. options is a Set of SocketIOClientOption. If your socket.io server is secure, you need to specify `https` in your socketURL. `init(var socketURL: NSURL, config: SocketIOClientConfiguration = [])` - Creates a new SocketIOClient. options is a Set of SocketIOClientOption. If your socket.io server is secure, you need to specify `https` in your socketURL.
`convenience init(socketURL: NSURL, options: NSDictionary?)` - Same as above, but meant for Objective-C. See Options on how convert between SocketIOClientOptions and dictionary keys. `convenience init(socketURL: NSURL, options: NSDictionary?)` - Same as above, but meant for Objective-C. See Options on how convert between SocketIOClientOptions and dictionary keys.

View File

@ -7,100 +7,70 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
572EF21F1B51F16C00EEBB58 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 572EF21F1B51F16C00EEBB58 /* SocketIO.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO.h */; settings = {ATTRIBUTES = (Public, ); }; };
572EF2251B51F16C00EEBB58 /* SocketIOClientSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */; }; 572EF2251B51F16C00EEBB58 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2191B51F16C00EEBB58 /* SocketIO.framework */; };
572EF23D1B51F18A00EEBB58 /* SocketIO-Mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */; settings = {ATTRIBUTES = (Public, ); }; }; 572EF23D1B51F18A00EEBB58 /* SocketIO-Mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */; settings = {ATTRIBUTES = (Public, ); }; };
572EF2431B51F18A00EEBB58 /* SocketIOClientSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */; }; 572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */; };
57634A111BD9B46A00E19CD7 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 57634A111BD9B46A00E19CD7 /* SocketIO.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO.h */; settings = {ATTRIBUTES = (Public, ); }; };
57634A231BD9B46D00E19CD7 /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; }; 57634A231BD9B46D00E19CD7 /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; };
57634A2A1BD9B46D00E19CD7 /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; }; 57634A2A1BD9B46D00E19CD7 /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; };
57634A2F1BD9B46D00E19CD7 /* SocketBasicPacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */; }; 57634A2F1BD9B46D00E19CD7 /* SocketBasicPacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */; };
57634A321BD9B46D00E19CD7 /* SocketNamespacePacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */; }; 57634A321BD9B46D00E19CD7 /* SocketNamespacePacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */; };
57634A3F1BD9B4BF00E19CD7 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57634A161BD9B46A00E19CD7 /* SocketIO.framework */; }; 57634A3F1BD9B4BF00E19CD7 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57634A161BD9B46A00E19CD7 /* SocketIO.framework */; };
6CA08A961D615C040061FD2A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA08A951D615C040061FD2A /* Security.framework */; };
6CA08A981D615C0B0061FD2A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA08A971D615C0B0061FD2A /* Security.framework */; };
6CA08A9A1D615C140061FD2A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA08A991D615C140061FD2A /* Security.framework */; };
740CA1201C496EEB00CB98F4 /* SocketEngineWebsocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 740CA11F1C496EEB00CB98F4 /* SocketEngineWebsocket.swift */; }; 740CA1201C496EEB00CB98F4 /* SocketEngineWebsocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 740CA11F1C496EEB00CB98F4 /* SocketEngineWebsocket.swift */; };
740CA1211C496EF200CB98F4 /* SocketEngineWebsocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 740CA11F1C496EEB00CB98F4 /* SocketEngineWebsocket.swift */; }; 740CA1211C496EF200CB98F4 /* SocketEngineWebsocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 740CA11F1C496EEB00CB98F4 /* SocketEngineWebsocket.swift */; };
740CA1221C496EF700CB98F4 /* SocketEngineWebsocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 740CA11F1C496EEB00CB98F4 /* SocketEngineWebsocket.swift */; }; 740CA1221C496EF700CB98F4 /* SocketEngineWebsocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 740CA11F1C496EEB00CB98F4 /* SocketEngineWebsocket.swift */; };
74171E631C10CD240062D398 /* SocketAckEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E501C10CD240062D398 /* SocketAckEmitter.swift */; }; 74171E631C10CD240062D398 /* SocketAckEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E501C10CD240062D398 /* SocketAckEmitter.swift */; };
74171E641C10CD240062D398 /* SocketAckEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E501C10CD240062D398 /* SocketAckEmitter.swift */; };
74171E651C10CD240062D398 /* SocketAckEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E501C10CD240062D398 /* SocketAckEmitter.swift */; }; 74171E651C10CD240062D398 /* SocketAckEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E501C10CD240062D398 /* SocketAckEmitter.swift */; };
74171E671C10CD240062D398 /* SocketAckEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E501C10CD240062D398 /* SocketAckEmitter.swift */; }; 74171E671C10CD240062D398 /* SocketAckEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E501C10CD240062D398 /* SocketAckEmitter.swift */; };
74171E681C10CD240062D398 /* SocketAckEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E501C10CD240062D398 /* SocketAckEmitter.swift */; };
74171E691C10CD240062D398 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E511C10CD240062D398 /* SocketAckManager.swift */; }; 74171E691C10CD240062D398 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E511C10CD240062D398 /* SocketAckManager.swift */; };
74171E6A1C10CD240062D398 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E511C10CD240062D398 /* SocketAckManager.swift */; };
74171E6B1C10CD240062D398 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E511C10CD240062D398 /* SocketAckManager.swift */; }; 74171E6B1C10CD240062D398 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E511C10CD240062D398 /* SocketAckManager.swift */; };
74171E6D1C10CD240062D398 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E511C10CD240062D398 /* SocketAckManager.swift */; }; 74171E6D1C10CD240062D398 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E511C10CD240062D398 /* SocketAckManager.swift */; };
74171E6E1C10CD240062D398 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E511C10CD240062D398 /* SocketAckManager.swift */; };
74171E6F1C10CD240062D398 /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E521C10CD240062D398 /* SocketAnyEvent.swift */; }; 74171E6F1C10CD240062D398 /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E521C10CD240062D398 /* SocketAnyEvent.swift */; };
74171E701C10CD240062D398 /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E521C10CD240062D398 /* SocketAnyEvent.swift */; };
74171E711C10CD240062D398 /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E521C10CD240062D398 /* SocketAnyEvent.swift */; }; 74171E711C10CD240062D398 /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E521C10CD240062D398 /* SocketAnyEvent.swift */; };
74171E731C10CD240062D398 /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E521C10CD240062D398 /* SocketAnyEvent.swift */; }; 74171E731C10CD240062D398 /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E521C10CD240062D398 /* SocketAnyEvent.swift */; };
74171E741C10CD240062D398 /* SocketAnyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E521C10CD240062D398 /* SocketAnyEvent.swift */; };
74171E751C10CD240062D398 /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E531C10CD240062D398 /* SocketEngine.swift */; }; 74171E751C10CD240062D398 /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E531C10CD240062D398 /* SocketEngine.swift */; };
74171E761C10CD240062D398 /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E531C10CD240062D398 /* SocketEngine.swift */; };
74171E771C10CD240062D398 /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E531C10CD240062D398 /* SocketEngine.swift */; }; 74171E771C10CD240062D398 /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E531C10CD240062D398 /* SocketEngine.swift */; };
74171E791C10CD240062D398 /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E531C10CD240062D398 /* SocketEngine.swift */; }; 74171E791C10CD240062D398 /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E531C10CD240062D398 /* SocketEngine.swift */; };
74171E7A1C10CD240062D398 /* SocketEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E531C10CD240062D398 /* SocketEngine.swift */; };
74171E7B1C10CD240062D398 /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E541C10CD240062D398 /* SocketEngineClient.swift */; }; 74171E7B1C10CD240062D398 /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E541C10CD240062D398 /* SocketEngineClient.swift */; };
74171E7C1C10CD240062D398 /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E541C10CD240062D398 /* SocketEngineClient.swift */; };
74171E7D1C10CD240062D398 /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E541C10CD240062D398 /* SocketEngineClient.swift */; }; 74171E7D1C10CD240062D398 /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E541C10CD240062D398 /* SocketEngineClient.swift */; };
74171E7F1C10CD240062D398 /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E541C10CD240062D398 /* SocketEngineClient.swift */; }; 74171E7F1C10CD240062D398 /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E541C10CD240062D398 /* SocketEngineClient.swift */; };
74171E801C10CD240062D398 /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E541C10CD240062D398 /* SocketEngineClient.swift */; };
74171E811C10CD240062D398 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E551C10CD240062D398 /* SocketEnginePacketType.swift */; }; 74171E811C10CD240062D398 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E551C10CD240062D398 /* SocketEnginePacketType.swift */; };
74171E821C10CD240062D398 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E551C10CD240062D398 /* SocketEnginePacketType.swift */; };
74171E831C10CD240062D398 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E551C10CD240062D398 /* SocketEnginePacketType.swift */; }; 74171E831C10CD240062D398 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E551C10CD240062D398 /* SocketEnginePacketType.swift */; };
74171E851C10CD240062D398 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E551C10CD240062D398 /* SocketEnginePacketType.swift */; }; 74171E851C10CD240062D398 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E551C10CD240062D398 /* SocketEnginePacketType.swift */; };
74171E861C10CD240062D398 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E551C10CD240062D398 /* SocketEnginePacketType.swift */; };
74171E871C10CD240062D398 /* SocketEngineSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E561C10CD240062D398 /* SocketEngineSpec.swift */; }; 74171E871C10CD240062D398 /* SocketEngineSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E561C10CD240062D398 /* SocketEngineSpec.swift */; };
74171E881C10CD240062D398 /* SocketEngineSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E561C10CD240062D398 /* SocketEngineSpec.swift */; };
74171E891C10CD240062D398 /* SocketEngineSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E561C10CD240062D398 /* SocketEngineSpec.swift */; }; 74171E891C10CD240062D398 /* SocketEngineSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E561C10CD240062D398 /* SocketEngineSpec.swift */; };
74171E8B1C10CD240062D398 /* SocketEngineSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E561C10CD240062D398 /* SocketEngineSpec.swift */; }; 74171E8B1C10CD240062D398 /* SocketEngineSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E561C10CD240062D398 /* SocketEngineSpec.swift */; };
74171E8C1C10CD240062D398 /* SocketEngineSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E561C10CD240062D398 /* SocketEngineSpec.swift */; };
74171E8D1C10CD240062D398 /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E571C10CD240062D398 /* SocketEventHandler.swift */; }; 74171E8D1C10CD240062D398 /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E571C10CD240062D398 /* SocketEventHandler.swift */; };
74171E8E1C10CD240062D398 /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E571C10CD240062D398 /* SocketEventHandler.swift */; };
74171E8F1C10CD240062D398 /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E571C10CD240062D398 /* SocketEventHandler.swift */; }; 74171E8F1C10CD240062D398 /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E571C10CD240062D398 /* SocketEventHandler.swift */; };
74171E911C10CD240062D398 /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E571C10CD240062D398 /* SocketEventHandler.swift */; }; 74171E911C10CD240062D398 /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E571C10CD240062D398 /* SocketEventHandler.swift */; };
74171E921C10CD240062D398 /* SocketEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E571C10CD240062D398 /* SocketEventHandler.swift */; };
74171E991C10CD240062D398 /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E591C10CD240062D398 /* SocketIOClient.swift */; }; 74171E991C10CD240062D398 /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E591C10CD240062D398 /* SocketIOClient.swift */; };
74171E9A1C10CD240062D398 /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E591C10CD240062D398 /* SocketIOClient.swift */; };
74171E9B1C10CD240062D398 /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E591C10CD240062D398 /* SocketIOClient.swift */; }; 74171E9B1C10CD240062D398 /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E591C10CD240062D398 /* SocketIOClient.swift */; };
74171E9D1C10CD240062D398 /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E591C10CD240062D398 /* SocketIOClient.swift */; }; 74171E9D1C10CD240062D398 /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E591C10CD240062D398 /* SocketIOClient.swift */; };
74171E9E1C10CD240062D398 /* SocketIOClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E591C10CD240062D398 /* SocketIOClient.swift */; };
74171E9F1C10CD240062D398 /* SocketIOClientOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */; }; 74171E9F1C10CD240062D398 /* SocketIOClientOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */; };
74171EA01C10CD240062D398 /* SocketIOClientOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */; };
74171EA11C10CD240062D398 /* SocketIOClientOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */; }; 74171EA11C10CD240062D398 /* SocketIOClientOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */; };
74171EA31C10CD240062D398 /* SocketIOClientOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */; }; 74171EA31C10CD240062D398 /* SocketIOClientOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */; };
74171EA41C10CD240062D398 /* SocketIOClientOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */; };
74171EA51C10CD240062D398 /* SocketIOClientStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */; }; 74171EA51C10CD240062D398 /* SocketIOClientStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */; };
74171EA61C10CD240062D398 /* SocketIOClientStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */; };
74171EA71C10CD240062D398 /* SocketIOClientStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */; }; 74171EA71C10CD240062D398 /* SocketIOClientStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */; };
74171EA81C10CD240062D398 /* SocketIOClientStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */; };
74171EA91C10CD240062D398 /* SocketIOClientStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */; }; 74171EA91C10CD240062D398 /* SocketIOClientStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */; };
74171EAA1C10CD240062D398 /* SocketIOClientStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */; };
74171EAB1C10CD240062D398 /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5C1C10CD240062D398 /* SocketLogger.swift */; }; 74171EAB1C10CD240062D398 /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5C1C10CD240062D398 /* SocketLogger.swift */; };
74171EAC1C10CD240062D398 /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5C1C10CD240062D398 /* SocketLogger.swift */; };
74171EAD1C10CD240062D398 /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5C1C10CD240062D398 /* SocketLogger.swift */; }; 74171EAD1C10CD240062D398 /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5C1C10CD240062D398 /* SocketLogger.swift */; };
74171EAF1C10CD240062D398 /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5C1C10CD240062D398 /* SocketLogger.swift */; }; 74171EAF1C10CD240062D398 /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5C1C10CD240062D398 /* SocketLogger.swift */; };
74171EB01C10CD240062D398 /* SocketLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5C1C10CD240062D398 /* SocketLogger.swift */; };
74171EB11C10CD240062D398 /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5D1C10CD240062D398 /* SocketPacket.swift */; }; 74171EB11C10CD240062D398 /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5D1C10CD240062D398 /* SocketPacket.swift */; };
74171EB21C10CD240062D398 /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5D1C10CD240062D398 /* SocketPacket.swift */; };
74171EB31C10CD240062D398 /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5D1C10CD240062D398 /* SocketPacket.swift */; }; 74171EB31C10CD240062D398 /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5D1C10CD240062D398 /* SocketPacket.swift */; };
74171EB51C10CD240062D398 /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5D1C10CD240062D398 /* SocketPacket.swift */; }; 74171EB51C10CD240062D398 /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5D1C10CD240062D398 /* SocketPacket.swift */; };
74171EB61C10CD240062D398 /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5D1C10CD240062D398 /* SocketPacket.swift */; };
74171EB71C10CD240062D398 /* SocketParsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5E1C10CD240062D398 /* SocketParsable.swift */; }; 74171EB71C10CD240062D398 /* SocketParsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5E1C10CD240062D398 /* SocketParsable.swift */; };
74171EB81C10CD240062D398 /* SocketParsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5E1C10CD240062D398 /* SocketParsable.swift */; };
74171EB91C10CD240062D398 /* SocketParsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5E1C10CD240062D398 /* SocketParsable.swift */; }; 74171EB91C10CD240062D398 /* SocketParsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5E1C10CD240062D398 /* SocketParsable.swift */; };
74171EBB1C10CD240062D398 /* SocketParsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5E1C10CD240062D398 /* SocketParsable.swift */; }; 74171EBB1C10CD240062D398 /* SocketParsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5E1C10CD240062D398 /* SocketParsable.swift */; };
74171EBC1C10CD240062D398 /* SocketParsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5E1C10CD240062D398 /* SocketParsable.swift */; };
74171EBD1C10CD240062D398 /* SocketStringReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5F1C10CD240062D398 /* SocketStringReader.swift */; }; 74171EBD1C10CD240062D398 /* SocketStringReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5F1C10CD240062D398 /* SocketStringReader.swift */; };
74171EBE1C10CD240062D398 /* SocketStringReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5F1C10CD240062D398 /* SocketStringReader.swift */; };
74171EBF1C10CD240062D398 /* SocketStringReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5F1C10CD240062D398 /* SocketStringReader.swift */; }; 74171EBF1C10CD240062D398 /* SocketStringReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5F1C10CD240062D398 /* SocketStringReader.swift */; };
74171EC11C10CD240062D398 /* SocketStringReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5F1C10CD240062D398 /* SocketStringReader.swift */; }; 74171EC11C10CD240062D398 /* SocketStringReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5F1C10CD240062D398 /* SocketStringReader.swift */; };
74171EC21C10CD240062D398 /* SocketStringReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E5F1C10CD240062D398 /* SocketStringReader.swift */; };
74171EC31C10CD240062D398 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E601C10CD240062D398 /* SocketTypes.swift */; }; 74171EC31C10CD240062D398 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E601C10CD240062D398 /* SocketTypes.swift */; };
74171EC41C10CD240062D398 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E601C10CD240062D398 /* SocketTypes.swift */; };
74171EC51C10CD240062D398 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E601C10CD240062D398 /* SocketTypes.swift */; }; 74171EC51C10CD240062D398 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E601C10CD240062D398 /* SocketTypes.swift */; };
74171EC71C10CD240062D398 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E601C10CD240062D398 /* SocketTypes.swift */; }; 74171EC71C10CD240062D398 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E601C10CD240062D398 /* SocketTypes.swift */; };
74171EC81C10CD240062D398 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74171E601C10CD240062D398 /* SocketTypes.swift */; };
741F39EE1BD025D80026C9CC /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; }; 741F39EE1BD025D80026C9CC /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; };
741F39EF1BD025D80026C9CC /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; }; 741F39EF1BD025D80026C9CC /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; };
7420CB791C49629E00956AA4 /* SocketEnginePollable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7420CB781C49629E00956AA4 /* SocketEnginePollable.swift */; }; 7420CB791C49629E00956AA4 /* SocketEnginePollable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7420CB781C49629E00956AA4 /* SocketEnginePollable.swift */; };
@ -115,6 +85,10 @@
7472C65D1BCAB53E003CA70D /* SocketNamespacePacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */; }; 7472C65D1BCAB53E003CA70D /* SocketNamespacePacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */; };
7472C65F1BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; }; 7472C65F1BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; };
7472C6601BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; }; 7472C6601BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; };
747BC5991D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 747BC5981D5F943500CA5FA4 /* SocketIOClientConfiguration.swift */; };
747BC59A1D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 747BC5981D5F943500CA5FA4 /* SocketIOClientConfiguration.swift */; };
747BC59B1D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 747BC5981D5F943500CA5FA4 /* SocketIOClientConfiguration.swift */; };
747BC59F1D5F9BA200CA5FA4 /* SocketIOClientConfigurationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 747BC59E1D5F9BA200CA5FA4 /* SocketIOClientConfigurationTest.swift */; };
749642B51D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */; }; 749642B51D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */; };
749642B61D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */; }; 749642B61D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */; };
749642B71D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */; }; 749642B71D3FCE5500DD32D1 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */; };
@ -157,17 +131,20 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIOClientSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 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>"; }; 572EF21D1B51F16C00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-iOS.h"; sourceTree = "<group>"; }; 572EF21E1B51F16C00EEBB58 /* SocketIO.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SocketIO.h; sourceTree = "<group>"; };
572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIOClientSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 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>"; }; 572EF23B1B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-Mac.h"; sourceTree = "<group>"; }; 572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-Mac.h"; sourceTree = "<group>"; };
572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
572EF2481B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 572EF2481B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
57634A161BD9B46A00E19CD7 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 57634A161BD9B46A00E19CD7 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
57634A3B1BD9B46D00E19CD7 /* SocketIO-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 57634A3B1BD9B46D00E19CD7 /* SocketIO-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
6CA08A951D615C040061FD2A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
6CA08A971D615C0B0061FD2A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
6CA08A991D615C140061FD2A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.2.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
740CA11F1C496EEB00CB98F4 /* SocketEngineWebsocket.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SocketEngineWebsocket.swift; path = Source/SocketEngineWebsocket.swift; sourceTree = "<group>"; }; 740CA11F1C496EEB00CB98F4 /* SocketEngineWebsocket.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SocketEngineWebsocket.swift; path = Source/SocketEngineWebsocket.swift; sourceTree = "<group>"; };
74171E501C10CD240062D398 /* SocketAckEmitter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketAckEmitter.swift; path = Source/SocketAckEmitter.swift; sourceTree = "<group>"; }; 74171E501C10CD240062D398 /* SocketAckEmitter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketAckEmitter.swift; path = Source/SocketAckEmitter.swift; sourceTree = "<group>"; };
74171E511C10CD240062D398 /* SocketAckManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketAckManager.swift; path = Source/SocketAckManager.swift; sourceTree = "<group>"; }; 74171E511C10CD240062D398 /* SocketAckManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketAckManager.swift; path = Source/SocketAckManager.swift; sourceTree = "<group>"; };
@ -192,6 +169,8 @@
74321DCA1C2D939A00CF6F43 /* SocketParserTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocketParserTest.swift; sourceTree = "<group>"; }; 74321DCA1C2D939A00CF6F43 /* SocketParserTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocketParserTest.swift; sourceTree = "<group>"; };
7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketNamespacePacketTest.swift; sourceTree = "<group>"; }; 7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketNamespacePacketTest.swift; sourceTree = "<group>"; };
7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketSideEffectTest.swift; sourceTree = "<group>"; }; 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketSideEffectTest.swift; sourceTree = "<group>"; };
747BC5981D5F943500CA5FA4 /* SocketIOClientConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketIOClientConfiguration.swift; path = Source/SocketIOClientConfiguration.swift; sourceTree = "<group>"; };
747BC59E1D5F9BA200CA5FA4 /* SocketIOClientConfigurationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketIOClientConfigurationTest.swift; sourceTree = "<group>"; };
749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SSLSecurity.swift; path = Source/SSLSecurity.swift; sourceTree = "<group>"; }; 749642B31D3FCE5500DD32D1 /* SSLSecurity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SSLSecurity.swift; path = Source/SSLSecurity.swift; sourceTree = "<group>"; };
749642B41D3FCE5500DD32D1 /* WebSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebSocket.swift; path = Source/WebSocket.swift; sourceTree = "<group>"; }; 749642B41D3FCE5500DD32D1 /* WebSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebSocket.swift; path = Source/WebSocket.swift; sourceTree = "<group>"; };
74ABF7761C3991C10078C657 /* SocketIOClientSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketIOClientSpec.swift; path = Source/SocketIOClientSpec.swift; sourceTree = "<group>"; }; 74ABF7761C3991C10078C657 /* SocketIOClientSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketIOClientSpec.swift; path = Source/SocketIOClientSpec.swift; sourceTree = "<group>"; };
@ -205,6 +184,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
6CA08A961D615C040061FD2A /* Security.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -212,7 +192,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
572EF2251B51F16C00EEBB58 /* SocketIOClientSwift.framework in Frameworks */, 572EF2251B51F16C00EEBB58 /* SocketIO.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -220,6 +200,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
6CA08A981D615C0B0061FD2A /* Security.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -227,7 +208,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
572EF2431B51F18A00EEBB58 /* SocketIOClientSwift.framework in Frameworks */, 572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -235,6 +216,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
6CA08A9A1D615C140061FD2A /* Security.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -252,20 +234,21 @@
572EF20D1B51F12F00EEBB58 = { 572EF20D1B51F12F00EEBB58 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
5764DF7B1B51F24A004FF46E /* Source */, 6CA08A9B1D615C190061FD2A /* Frameworks */,
572EF21A1B51F16C00EEBB58 /* Products */,
572EF21B1B51F16C00EEBB58 /* SocketIO-iOS */, 572EF21B1B51F16C00EEBB58 /* SocketIO-iOS */,
572EF2391B51F18A00EEBB58 /* SocketIO-Mac */, 572EF2391B51F18A00EEBB58 /* SocketIO-Mac */,
572EF2461B51F18A00EEBB58 /* SocketIO-MacTests */, 572EF2461B51F18A00EEBB58 /* SocketIO-MacTests */,
572EF21A1B51F16C00EEBB58 /* Products */, 5764DF7B1B51F24A004FF46E /* Source */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
572EF21A1B51F16C00EEBB58 /* Products */ = { 572EF21A1B51F16C00EEBB58 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */, 572EF2191B51F16C00EEBB58 /* SocketIO.framework */,
572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */, 572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */,
572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */, 572EF2381B51F18A00EEBB58 /* SocketIO.framework */,
572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */, 572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */,
57634A161BD9B46A00E19CD7 /* SocketIO.framework */, 57634A161BD9B46A00E19CD7 /* SocketIO.framework */,
57634A3B1BD9B46D00E19CD7 /* SocketIO-tvOSTests.xctest */, 57634A3B1BD9B46D00E19CD7 /* SocketIO-tvOSTests.xctest */,
@ -276,7 +259,7 @@
572EF21B1B51F16C00EEBB58 /* SocketIO-iOS */ = { 572EF21B1B51F16C00EEBB58 /* SocketIO-iOS */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */, 572EF21E1B51F16C00EEBB58 /* SocketIO.h */,
572EF21C1B51F16C00EEBB58 /* Supporting Files */, 572EF21C1B51F16C00EEBB58 /* Supporting Files */,
); );
path = "SocketIO-iOS"; path = "SocketIO-iOS";
@ -314,6 +297,7 @@
74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */, 74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */,
741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */, 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */,
7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */, 7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */,
747BC59E1D5F9BA200CA5FA4 /* SocketIOClientConfigurationTest.swift */,
742D150B1CA5794B00BD987D /* SocketObjectiveCTest.m */, 742D150B1CA5794B00BD987D /* SocketObjectiveCTest.m */,
74321DCA1C2D939A00CF6F43 /* SocketParserTest.swift */, 74321DCA1C2D939A00CF6F43 /* SocketParserTest.swift */,
7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */, 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */,
@ -346,6 +330,7 @@
74171E571C10CD240062D398 /* SocketEventHandler.swift */, 74171E571C10CD240062D398 /* SocketEventHandler.swift */,
CEBA56991CDA0B8200BA0389 /* SocketExtensions.swift */, CEBA56991CDA0B8200BA0389 /* SocketExtensions.swift */,
74171E591C10CD240062D398 /* SocketIOClient.swift */, 74171E591C10CD240062D398 /* SocketIOClient.swift */,
747BC5981D5F943500CA5FA4 /* SocketIOClientConfiguration.swift */,
74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */, 74171E5A1C10CD240062D398 /* SocketIOClientOption.swift */,
74ABF7761C3991C10078C657 /* SocketIOClientSpec.swift */, 74ABF7761C3991C10078C657 /* SocketIOClientSpec.swift */,
74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */, 74171E5B1C10CD240062D398 /* SocketIOClientStatus.swift */,
@ -359,6 +344,40 @@
name = Source; name = Source;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
6CA08A9B1D615C190061FD2A /* Frameworks */ = {
isa = PBXGroup;
children = (
6CA08A9E1D615C340061FD2A /* tvOS */,
6CA08A9D1D615C2C0061FD2A /* Mac */,
6CA08A9C1D615C270061FD2A /* iOS */,
);
name = Frameworks;
sourceTree = "<group>";
};
6CA08A9C1D615C270061FD2A /* iOS */ = {
isa = PBXGroup;
children = (
6CA08A951D615C040061FD2A /* Security.framework */,
);
name = iOS;
sourceTree = "<group>";
};
6CA08A9D1D615C2C0061FD2A /* Mac */ = {
isa = PBXGroup;
children = (
6CA08A971D615C0B0061FD2A /* Security.framework */,
);
name = Mac;
sourceTree = "<group>";
};
6CA08A9E1D615C340061FD2A /* tvOS */ = {
isa = PBXGroup;
children = (
6CA08A991D615C140061FD2A /* Security.framework */,
);
name = tvOS;
sourceTree = "<group>";
};
74B4AD1B1D09A5C30062A523 /* Websocket */ = { 74B4AD1B1D09A5C30062A523 /* Websocket */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -375,7 +394,7 @@
isa = PBXHeadersBuildPhase; isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
572EF21F1B51F16C00EEBB58 /* SocketIO-iOS.h in Headers */, 572EF21F1B51F16C00EEBB58 /* SocketIO.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -391,7 +410,7 @@
isa = PBXHeadersBuildPhase; isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
57634A111BD9B46A00E19CD7 /* SocketIO-iOS.h in Headers */, 57634A111BD9B46A00E19CD7 /* SocketIO.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -413,7 +432,7 @@
); );
name = "SocketIO-iOS"; name = "SocketIO-iOS";
productName = "SocketIO-iOS"; productName = "SocketIO-iOS";
productReference = 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */; productReference = 572EF2191B51F16C00EEBB58 /* SocketIO.framework */;
productType = "com.apple.product-type.framework"; productType = "com.apple.product-type.framework";
}; };
572EF2231B51F16C00EEBB58 /* SocketIO-iOSTests */ = { 572EF2231B51F16C00EEBB58 /* SocketIO-iOSTests */ = {
@ -449,7 +468,7 @@
); );
name = "SocketIO-Mac"; name = "SocketIO-Mac";
productName = "SocketIO-Mac"; productName = "SocketIO-Mac";
productReference = 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */; productReference = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */;
productType = "com.apple.product-type.framework"; productType = "com.apple.product-type.framework";
}; };
572EF2411B51F18A00EEBB58 /* SocketIO-MacTests */ = { 572EF2411B51F18A00EEBB58 /* SocketIO-MacTests */ = {
@ -622,6 +641,7 @@
74171EB71C10CD240062D398 /* SocketParsable.swift in Sources */, 74171EB71C10CD240062D398 /* SocketParsable.swift in Sources */,
74171E811C10CD240062D398 /* SocketEnginePacketType.swift in Sources */, 74171E811C10CD240062D398 /* SocketEnginePacketType.swift in Sources */,
74171E6F1C10CD240062D398 /* SocketAnyEvent.swift in Sources */, 74171E6F1C10CD240062D398 /* SocketAnyEvent.swift in Sources */,
747BC5991D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */,
74171E9F1C10CD240062D398 /* SocketIOClientOption.swift in Sources */, 74171E9F1C10CD240062D398 /* SocketIOClientOption.swift in Sources */,
74BC45AB1D0C6675008CC431 /* SocketClientManager.swift in Sources */, 74BC45AB1D0C6675008CC431 /* SocketClientManager.swift in Sources */,
); );
@ -632,25 +652,9 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
7472C65F1BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */, 7472C65F1BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */,
74171EA61C10CD240062D398 /* SocketIOClientStatus.swift in Sources */,
74171E881C10CD240062D398 /* SocketEngineSpec.swift in Sources */,
74171EA01C10CD240062D398 /* SocketIOClientOption.swift in Sources */,
74171E701C10CD240062D398 /* SocketAnyEvent.swift in Sources */,
74171EC41C10CD240062D398 /* SocketTypes.swift in Sources */,
74171E8E1C10CD240062D398 /* SocketEventHandler.swift in Sources */,
74171E7C1C10CD240062D398 /* SocketEngineClient.swift in Sources */,
74171E821C10CD240062D398 /* SocketEnginePacketType.swift in Sources */,
74171EB21C10CD240062D398 /* SocketPacket.swift in Sources */,
741F39EE1BD025D80026C9CC /* SocketEngineTest.swift in Sources */, 741F39EE1BD025D80026C9CC /* SocketEngineTest.swift in Sources */,
74171EBE1C10CD240062D398 /* SocketStringReader.swift in Sources */,
74F124F01BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */, 74F124F01BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */,
74171E6A1C10CD240062D398 /* SocketAckManager.swift in Sources */,
74171E761C10CD240062D398 /* SocketEngine.swift in Sources */,
74171E641C10CD240062D398 /* SocketAckEmitter.swift in Sources */,
74171EB81C10CD240062D398 /* SocketParsable.swift in Sources */,
74171EAC1C10CD240062D398 /* SocketLogger.swift in Sources */,
7472C65C1BCAB53E003CA70D /* SocketNamespacePacketTest.swift in Sources */, 7472C65C1BCAB53E003CA70D /* SocketNamespacePacketTest.swift in Sources */,
74171E9A1C10CD240062D398 /* SocketIOClient.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -679,6 +683,7 @@
74171EB91C10CD240062D398 /* SocketParsable.swift in Sources */, 74171EB91C10CD240062D398 /* SocketParsable.swift in Sources */,
74171E831C10CD240062D398 /* SocketEnginePacketType.swift in Sources */, 74171E831C10CD240062D398 /* SocketEnginePacketType.swift in Sources */,
74171E711C10CD240062D398 /* SocketAnyEvent.swift in Sources */, 74171E711C10CD240062D398 /* SocketAnyEvent.swift in Sources */,
747BC59A1D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */,
74171EA11C10CD240062D398 /* SocketIOClientOption.swift in Sources */, 74171EA11C10CD240062D398 /* SocketIOClientOption.swift in Sources */,
74BC45AC1D0C6675008CC431 /* SocketClientManager.swift in Sources */, 74BC45AC1D0C6675008CC431 /* SocketClientManager.swift in Sources */,
); );
@ -691,8 +696,8 @@
742D150C1CA5794B00BD987D /* SocketObjectiveCTest.m in Sources */, 742D150C1CA5794B00BD987D /* SocketObjectiveCTest.m in Sources */,
74321DCB1C2D939A00CF6F43 /* SocketAckManagerTest.swift in Sources */, 74321DCB1C2D939A00CF6F43 /* SocketAckManagerTest.swift in Sources */,
74321DCC1C2D939A00CF6F43 /* SocketParserTest.swift in Sources */, 74321DCC1C2D939A00CF6F43 /* SocketParserTest.swift in Sources */,
747BC59F1D5F9BA200CA5FA4 /* SocketIOClientConfigurationTest.swift in Sources */,
7472C6601BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */, 7472C6601BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */,
74171EA81C10CD240062D398 /* SocketIOClientStatus.swift in Sources */,
741F39EF1BD025D80026C9CC /* SocketEngineTest.swift in Sources */, 741F39EF1BD025D80026C9CC /* SocketEngineTest.swift in Sources */,
74F124F11BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */, 74F124F11BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */,
7472C65D1BCAB53E003CA70D /* SocketNamespacePacketTest.swift in Sources */, 7472C65D1BCAB53E003CA70D /* SocketNamespacePacketTest.swift in Sources */,
@ -724,6 +729,7 @@
74171EBB1C10CD240062D398 /* SocketParsable.swift in Sources */, 74171EBB1C10CD240062D398 /* SocketParsable.swift in Sources */,
74171E851C10CD240062D398 /* SocketEnginePacketType.swift in Sources */, 74171E851C10CD240062D398 /* SocketEnginePacketType.swift in Sources */,
74171E731C10CD240062D398 /* SocketAnyEvent.swift in Sources */, 74171E731C10CD240062D398 /* SocketAnyEvent.swift in Sources */,
747BC59B1D5F943500CA5FA4 /* SocketIOClientConfiguration.swift in Sources */,
74171EA31C10CD240062D398 /* SocketIOClientOption.swift in Sources */, 74171EA31C10CD240062D398 /* SocketIOClientOption.swift in Sources */,
74BC45AD1D0C6675008CC431 /* SocketClientManager.swift in Sources */, 74BC45AD1D0C6675008CC431 /* SocketClientManager.swift in Sources */,
); );
@ -734,25 +740,9 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
57634A231BD9B46D00E19CD7 /* SocketSideEffectTest.swift in Sources */, 57634A231BD9B46D00E19CD7 /* SocketSideEffectTest.swift in Sources */,
74171EAA1C10CD240062D398 /* SocketIOClientStatus.swift in Sources */,
74171E8C1C10CD240062D398 /* SocketEngineSpec.swift in Sources */,
74171EA41C10CD240062D398 /* SocketIOClientOption.swift in Sources */,
74171E741C10CD240062D398 /* SocketAnyEvent.swift in Sources */,
74171EC81C10CD240062D398 /* SocketTypes.swift in Sources */,
74171E921C10CD240062D398 /* SocketEventHandler.swift in Sources */,
74171E801C10CD240062D398 /* SocketEngineClient.swift in Sources */,
74171E861C10CD240062D398 /* SocketEnginePacketType.swift in Sources */,
74171EB61C10CD240062D398 /* SocketPacket.swift in Sources */,
57634A2A1BD9B46D00E19CD7 /* SocketEngineTest.swift in Sources */, 57634A2A1BD9B46D00E19CD7 /* SocketEngineTest.swift in Sources */,
74171EC21C10CD240062D398 /* SocketStringReader.swift in Sources */,
57634A2F1BD9B46D00E19CD7 /* SocketBasicPacketTest.swift in Sources */, 57634A2F1BD9B46D00E19CD7 /* SocketBasicPacketTest.swift in Sources */,
74171E6E1C10CD240062D398 /* SocketAckManager.swift in Sources */,
74171E7A1C10CD240062D398 /* SocketEngine.swift in Sources */,
74171E681C10CD240062D398 /* SocketAckEmitter.swift in Sources */,
74171EBC1C10CD240062D398 /* SocketParsable.swift in Sources */,
74171EB01C10CD240062D398 /* SocketLogger.swift in Sources */,
57634A321BD9B46D00E19CD7 /* SocketNamespacePacketTest.swift in Sources */, 57634A321BD9B46D00E19CD7 /* SocketNamespacePacketTest.swift in Sources */,
74171E9E1C10CD240062D398 /* SocketIOClient.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -788,7 +778,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10; MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = SocketIOClientSwift; PRODUCT_NAME = SocketIO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TVOS_DEPLOYMENT_TARGET = 9.0; TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0; WATCHOS_DEPLOYMENT_TARGET = 2.0;
@ -803,7 +793,7 @@
ENABLE_BITCODE = YES; ENABLE_BITCODE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10; MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = SocketIOClientSwift; PRODUCT_NAME = SocketIO;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TVOS_DEPLOYMENT_TARGET = 9.0; TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0; WATCHOS_DEPLOYMENT_TARGET = 2.0;
@ -958,7 +948,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-iOSTests/Info.plist"; INFOPLIST_FILE = "SocketIO-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.4; IPHONEOS_DEPLOYMENT_TARGET = 8.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
@ -1003,7 +993,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-iOSTests/Info.plist"; INFOPLIST_FILE = "SocketIO-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.4; IPHONEOS_DEPLOYMENT_TARGET = 8.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
@ -1373,7 +1363,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-iOSTests/Info.plist"; INFOPLIST_FILE = "SocketIO-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.4; IPHONEOS_DEPLOYMENT_TARGET = 8.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
@ -1418,7 +1408,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "SocketIO-iOSTests/Info.plist"; INFOPLIST_FILE = "SocketIO-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.4; IPHONEOS_DEPLOYMENT_TARGET = 8.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;

View File

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

View File

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

View File

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

View File

@ -0,0 +1,46 @@
//
// TestSocketIOClientConfiguration.swift
// Socket.IO-Client-Swift
//
// Created by Erik Little on 8/13/16.
//
//
import XCTest
import SocketIO
class TestSocketIOClientConfiguration: XCTestCase {
var config = [] as SocketIOClientConfiguration
override func setUp() {
super.setUp()
config = [.Log(false), .ForceNew(true)]
}
func testReplaceSameOption() {
config.insert(.Log(true))
XCTAssertEqual(config.count, 2)
switch config[0] {
case let .Log(log):
XCTAssertTrue(log)
default:
XCTFail()
}
}
func testIgnoreIfExisting() {
config.insert(.ForceNew(false), replacing: false)
XCTAssertEqual(config.count, 2)
switch config[1] {
case let .ForceNew(new):
XCTAssertTrue(new)
default:
XCTFail()
}
}
}

View File

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

View File

@ -8,7 +8,7 @@
// //
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
@import SocketIOClientSwift; @import SocketIO;
@interface SocketObjectiveCTest : XCTestCase @interface SocketObjectiveCTest : XCTestCase
@ -21,7 +21,7 @@
- (void)setUp { - (void)setUp {
[super setUp]; [super setUp];
NSURL* url = [[NSURL alloc] initWithString:@"http://localhost"]; NSURL* url = [[NSURL alloc] initWithString:@"http://localhost"];
self.socket = [[SocketIOClient alloc] initWithSocketURL:url options:nil]; self.socket = [[SocketIOClient alloc] initWithSocketURL:url config:nil];
} }
- (void)testOnSyntax { - (void)testOnSyntax {

View File

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

View File

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

View File

@ -88,10 +88,10 @@ public class SSLSecurity : NSObject {
- returns: a representation security object to be used with - returns: a representation security object to be used with
*/ */
public init(certs: [SSLCert], usePublicKeys: Bool) { public init(certs: [SSLCert], usePublicKeys: Bool) {
super.init()
self.usePublicKeys = usePublicKeys self.usePublicKeys = usePublicKeys
super.init()
if self.usePublicKeys { if self.usePublicKeys {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0)) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0)) {
let pubKeys = certs.reduce([SecKeyRef]()) { (pubKeys: [SecKeyRef], cert: SSLCert) -> [SecKeyRef] in let pubKeys = certs.reduce([SecKeyRef]()) { (pubKeys: [SecKeyRef], cert: SSLCert) -> [SecKeyRef] in

View File

@ -80,11 +80,11 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo
private var selfSigned = false private var selfSigned = false
private var voipEnabled = false private var voipEnabled = false
public init(client: SocketEngineClient, url: NSURL, options: Set<SocketIOClientOption>) { public init(client: SocketEngineClient, url: NSURL, config: SocketIOClientConfiguration) {
self.client = client self.client = client
self.url = url self.url = url
for option in options { for option in config {
switch option { switch option {
case let .ConnectParams(params): case let .ConnectParams(params):
connectParams = params connectParams = params
@ -127,7 +127,7 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo
} }
public convenience init(client: SocketEngineClient, url: NSURL, options: NSDictionary?) { public convenience init(client: SocketEngineClient, url: NSURL, options: NSDictionary?) {
self.init(client: client, url: url, options: options?.toSocketOptionsSet() ?? []) self.init(client: client, url: url, config: options?.toSocketConfiguration() ?? [])
} }
deinit { deinit {
@ -153,18 +153,12 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo
} }
} }
private func checkIfMessageIsBase64Binary(message: String) -> Bool { private func handleBase64(message: String) {
if message.hasPrefix("b4") { // binary in base64 string
// binary in base64 string let noPrefix = message[message.startIndex.advancedBy(2)..<message.endIndex]
let noPrefix = message[message.startIndex.advancedBy(2)..<message.endIndex]
if let data = NSData(base64EncodedString: noPrefix, options: .IgnoreUnknownCharacters) { if let data = NSData(base64EncodedString: noPrefix, options: .IgnoreUnknownCharacters) {
client?.parseEngineBinaryData(data) client?.parseEngineBinaryData(data)
}
return true
} else {
return false
} }
} }
@ -265,7 +259,7 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo
} }
} }
ws?.queue = handleQueue ws?.callbackQueue = handleQueue
ws?.voipEnabled = voipEnabled ws?.voipEnabled = voipEnabled
ws?.delegate = self ws?.delegate = self
ws?.selfSignedSSL = selfSigned ws?.selfSignedSSL = selfSigned
@ -420,10 +414,12 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo
let reader = SocketStringReader(message: message) let reader = SocketStringReader(message: message)
let fixedString: String let fixedString: String
if message.hasPrefix("b4") {
return handleBase64(message)
}
guard let type = SocketEnginePacketType(rawValue: Int(reader.currentCharacter) ?? -1) else { guard let type = SocketEnginePacketType(rawValue: Int(reader.currentCharacter) ?? -1) else {
if !checkIfMessageIsBase64Binary(message) { checkAndHandleEngineError(message)
checkAndHandleEngineError(message)
}
return return
} }

View File

@ -36,11 +36,72 @@ extension Array where Element: AnyObject {
} }
extension NSCharacterSet { extension NSCharacterSet {
class var allowedURLCharacterSet: NSCharacterSet { static var allowedURLCharacterSet: NSCharacterSet {
return NSCharacterSet(charactersInString: "!*'();:@&=+$,/?%#[]\" {}").invertedSet return NSCharacterSet(charactersInString: "!*'();:@&=+$,/?%#[]\" {}").invertedSet
} }
} }
extension NSDictionary {
private static func keyValueToSocketIOClientOption(key: String, value: AnyObject) -> SocketIOClientOption? {
switch (key, value) {
case let ("connectParams", params as [String: AnyObject]):
return .ConnectParams(params)
case let ("cookies", cookies as [NSHTTPCookie]):
return .Cookies(cookies)
case let ("doubleEncodeUTF8", encode as Bool):
return .DoubleEncodeUTF8(encode)
case let ("extraHeaders", headers as [String: String]):
return .ExtraHeaders(headers)
case let ("forceNew", force as Bool):
return .ForceNew(force)
case let ("forcePolling", force as Bool):
return .ForcePolling(force)
case let ("forceWebsockets", force as Bool):
return .ForceWebsockets(force)
case let ("handleQueue", queue as dispatch_queue_t):
return .HandleQueue(queue)
case let ("log", log as Bool):
return .Log(log)
case let ("logger", logger as SocketLogger):
return .Logger(logger)
case let ("nsp", nsp as String):
return .Nsp(nsp)
case let ("path", path as String):
return .Path(path)
case let ("reconnects", reconnects as Bool):
return .Reconnects(reconnects)
case let ("reconnectAttempts", attempts as Int):
return .ReconnectAttempts(attempts)
case let ("reconnectWait", wait as Int):
return .ReconnectWait(wait)
case let ("secure", secure as Bool):
return .Secure(secure)
case let ("security", security as SSLSecurity):
return .Security(security)
case let ("selfSigned", selfSigned as Bool):
return .SelfSigned(selfSigned)
case let ("sessionDelegate", delegate as NSURLSessionDelegate):
return .SessionDelegate(delegate)
case let ("voipEnabled", enable as Bool):
return .VoipEnabled(enable)
default:
return nil
}
}
func toSocketConfiguration() -> SocketIOClientConfiguration {
var options = [] as SocketIOClientConfiguration
for (rawKey, value) in self {
if let key = rawKey as? String, opt = NSDictionary.keyValueToSocketIOClientOption(key, value: value) {
options.insert(opt)
}
}
return options
}
}
extension String { extension String {
func toArray() throws -> [AnyObject] { func toArray() throws -> [AnyObject] {
guard let stringData = dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) else { return [] } guard let stringData = dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) else { return [] }

View File

@ -42,12 +42,9 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
public var forceNew = false public var forceNew = false
public var nsp = "/" public var nsp = "/"
public var options: Set<SocketIOClientOption> public var config: SocketIOClientConfiguration
public var reconnects = true public var reconnects = true
public var reconnectWait = 10 public var reconnectWait = 10
public var sid: String? {
return nsp + "#" + (engine?.sid ?? "")
}
private let ackQueue = dispatch_queue_create("com.socketio.ackQueue", DISPATCH_QUEUE_SERIAL) private let ackQueue = dispatch_queue_create("com.socketio.ackQueue", DISPATCH_QUEUE_SERIAL)
private let emitQueue = dispatch_queue_create("com.socketio.emitQueue", DISPATCH_QUEUE_SERIAL) private let emitQueue = dispatch_queue_create("com.socketio.emitQueue", DISPATCH_QUEUE_SERIAL)
@ -66,16 +63,20 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
var waitingPackets = [SocketPacket]() var waitingPackets = [SocketPacket]()
public var sid: String? {
return nsp + "#" + (engine?.sid ?? "")
}
/// Type safe way to create a new SocketIOClient. opts can be omitted /// Type safe way to create a new SocketIOClient. opts can be omitted
public init(socketURL: NSURL, options: Set<SocketIOClientOption> = []) { public init(socketURL: NSURL, config: SocketIOClientConfiguration = []) {
self.options = options self.config = config
self.socketURL = socketURL self.socketURL = socketURL
if socketURL.absoluteString.hasPrefix("https://") { if socketURL.absoluteString.hasPrefix("https://") {
self.options.insertIgnore(.Secure(true)) self.config.insert(.Secure(true))
} }
for option in options { for option in config {
switch option { switch option {
case let .Reconnects(reconnects): case let .Reconnects(reconnects):
self.reconnects = reconnects self.reconnects = reconnects
@ -98,15 +99,15 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
} }
} }
self.options.insertIgnore(.Path("/socket.io/")) self.config.insert(.Path("/socket.io/"), replacing: false)
super.init() super.init()
} }
/// Not so type safe way to create a SocketIOClient, meant for Objective-C compatiblity. /// Not so type safe way to create a SocketIOClient, meant for Objective-C compatiblity.
/// If using Swift it's recommended to use `init(socketURL: NSURL, options: Set<SocketIOClientOption>)` /// If using Swift it's recommended to use `init(socketURL: NSURL, options: Set<SocketIOClientOption>)`
public convenience init(socketURL: NSURL, options: NSDictionary?) { public convenience init(socketURL: NSURL, config: NSDictionary?) {
self.init(socketURL: socketURL, options: options?.toSocketOptionsSet() ?? []) self.init(socketURL: socketURL, config: config?.toSocketConfiguration() ?? [])
} }
deinit { deinit {
@ -117,7 +118,7 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
private func addEngine() -> SocketEngineSpec { private func addEngine() -> SocketEngineSpec {
DefaultSocketLogger.Logger.log("Adding engine", type: logType) DefaultSocketLogger.Logger.log("Adding engine", type: logType)
engine = SocketEngine(client: self, url: socketURL, options: options) engine = SocketEngine(client: self, url: socketURL, config: config)
return engine! return engine!
} }
@ -413,18 +414,16 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
} }
private func tryReconnectWithReason(reason: String) { private func tryReconnectWithReason(reason: String) {
if reconnecting { guard reconnecting else { return }
DefaultSocketLogger.Logger.log("Starting reconnect", type: logType)
handleEvent("reconnect", data: [reason], isInternalMessage: true)
_tryReconnect() DefaultSocketLogger.Logger.log("Starting reconnect", type: logType)
} handleEvent("reconnect", data: [reason], isInternalMessage: true)
_tryReconnect()
} }
private func _tryReconnect() { private func _tryReconnect() {
if !reconnecting { guard reconnecting else { return }
return
}
if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts || !reconnects { if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts || !reconnects {
return didDisconnect("Reconnect Failed") return didDisconnect("Reconnect Failed")
@ -437,9 +436,9 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
currentReconnectAttempt += 1 currentReconnectAttempt += 1
connect() connect()
let dispatchAfter = dispatch_time(DISPATCH_TIME_NOW, Int64(UInt64(reconnectWait) * NSEC_PER_SEC)) let time = dispatch_time(DISPATCH_TIME_NOW, Int64(UInt64(reconnectWait) * NSEC_PER_SEC))
dispatch_after(dispatchAfter, dispatch_get_main_queue(), _tryReconnect) dispatch_after(time, dispatch_get_main_queue(), _tryReconnect)
} }
} }
@ -458,6 +457,6 @@ extension SocketIOClient {
} }
func emitTest(event: String, _ data: AnyObject...) { func emitTest(event: String, _ data: AnyObject...) {
self._emit([event] + data) _emit([event] + data)
} }
} }

View File

@ -0,0 +1,107 @@
//
// SocketIOClientConfiguration.swift
// Socket.IO-Client-Swift
//
// Created by Erik Little on 8/13/16.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
public struct SocketIOClientConfiguration : ArrayLiteralConvertible, CollectionType, MutableCollectionType {
public typealias Element = SocketIOClientOption
public typealias Index = Array<SocketIOClientOption>.Index
public typealias Generator = Array<SocketIOClientOption>.Generator
public typealias SubSequence = Array<SocketIOClientOption>.SubSequence
private var backingArray = [SocketIOClientOption]()
public var startIndex: Index {
return backingArray.startIndex
}
public var endIndex: Index {
return backingArray.endIndex
}
public var isEmpty: Bool {
return backingArray.isEmpty
}
public var count: Index.Distance {
return backingArray.count
}
public var first: Generator.Element? {
return backingArray.first
}
public subscript(position: Index) -> Generator.Element {
get {
return backingArray[position]
}
set {
backingArray[position] = newValue
}
}
public subscript(bounds: Range<Index>) -> SubSequence {
get {
return backingArray[bounds]
}
set {
backingArray[bounds] = newValue
}
}
public init(arrayLiteral elements: Element...) {
backingArray = elements
}
public func generate() -> Generator {
return backingArray.generate()
}
public mutating func insert(element: Element, replacing replace: Bool = true) {
for i in 0..<backingArray.count where backingArray[i] == element {
guard replace else { return }
backingArray[i] = element
return
}
backingArray.append(element)
}
@warn_unused_result
public func prefixUpTo(end: Index) -> SubSequence {
return backingArray.prefixUpTo(end)
}
@warn_unused_result
public func prefixThrough(position: Index) -> SubSequence {
return prefixThrough(position)
}
@warn_unused_result
public func suffixFrom(start: Index) -> SubSequence {
return backingArray.suffixFrom(start)
}
}

View File

@ -24,7 +24,7 @@
import Foundation import Foundation
protocol ClientOption : CustomStringConvertible, Hashable { protocol ClientOption : CustomStringConvertible, Equatable {
func getSocketIOOptionValue() -> AnyObject func getSocketIOOptionValue() -> AnyObject
} }
@ -99,10 +99,6 @@ public enum SocketIOClientOption : ClientOption {
return description return description
} }
public var hashValue: Int {
return description.hashValue
}
func getSocketIOOptionValue() -> AnyObject { func getSocketIOOptionValue() -> AnyObject {
let value: AnyObject let value: AnyObject
@ -156,72 +152,3 @@ public enum SocketIOClientOption : ClientOption {
public func ==(lhs: SocketIOClientOption, rhs: SocketIOClientOption) -> Bool { public func ==(lhs: SocketIOClientOption, rhs: SocketIOClientOption) -> Bool {
return lhs.description == rhs.description return lhs.description == rhs.description
} }
extension Set where Element : ClientOption {
mutating func insertIgnore(element: Element) {
if !contains(element) {
insert(element)
}
}
}
extension NSDictionary {
private static func keyValueToSocketIOClientOption(key: String, value: AnyObject) -> SocketIOClientOption? {
switch (key, value) {
case let ("connectParams", params as [String: AnyObject]):
return .ConnectParams(params)
case let ("cookies", cookies as [NSHTTPCookie]):
return .Cookies(cookies)
case let ("doubleEncodeUTF8", encode as Bool):
return .DoubleEncodeUTF8(encode)
case let ("extraHeaders", headers as [String: String]):
return .ExtraHeaders(headers)
case let ("forceNew", force as Bool):
return .ForceNew(force)
case let ("forcePolling", force as Bool):
return .ForcePolling(force)
case let ("forceWebsockets", force as Bool):
return .ForceWebsockets(force)
case let ("handleQueue", queue as dispatch_queue_t):
return .HandleQueue(queue)
case let ("log", log as Bool):
return .Log(log)
case let ("logger", logger as SocketLogger):
return .Logger(logger)
case let ("nsp", nsp as String):
return .Nsp(nsp)
case let ("path", path as String):
return .Path(path)
case let ("reconnects", reconnects as Bool):
return .Reconnects(reconnects)
case let ("reconnectAttempts", attempts as Int):
return .ReconnectAttempts(attempts)
case let ("reconnectWait", wait as Int):
return .ReconnectWait(wait)
case let ("secure", secure as Bool):
return .Secure(secure)
case let ("security", security as SSLSecurity):
return .Security(security)
case let ("selfSigned", selfSigned as Bool):
return .SelfSigned(selfSigned)
case let ("sessionDelegate", delegate as NSURLSessionDelegate):
return .SessionDelegate(delegate)
case let ("voipEnabled", enable as Bool):
return .VoipEnabled(enable)
default:
return nil
}
}
func toSocketOptionsSet() -> Set<SocketIOClientOption> {
var options = Set<SocketIOClientOption>()
for (rawKey, value) in self {
if let key = rawKey as? String, opt = NSDictionary.keyValueToSocketIOClientOption(key, value: value) {
options.insertIgnore(opt)
}
}
return options
}
}

View File

@ -26,6 +26,10 @@
import Foundation import Foundation
struct SocketPacket { struct SocketPacket {
enum PacketType: Int {
case Connect, Disconnect, Event, Ack, Error, BinaryEvent, BinaryAck
}
private let placeholders: Int private let placeholders: Int
private static let logType = "SocketPacket" private static let logType = "SocketPacket"
@ -34,9 +38,8 @@ struct SocketPacket {
let id: Int let id: Int
let type: PacketType let type: PacketType
enum PacketType: Int { var binary: [NSData]
case Connect, Disconnect, Event, Ack, Error, BinaryEvent, BinaryAck var data: [AnyObject]
}
var args: [AnyObject] { var args: [AnyObject] {
if type == .Event || type == .BinaryEvent && data.count != 0 { if type == .Event || type == .BinaryEvent && data.count != 0 {
@ -46,8 +49,6 @@ struct SocketPacket {
} }
} }
var binary: [NSData]
var data: [AnyObject]
var description: String { var description: String {
return "SocketPacket {type: \(String(type.rawValue)); data: " + return "SocketPacket {type: \(String(type.rawValue)); data: " +
"\(String(data)); id: \(id); placeholders: \(placeholders); nsp: \(nsp)}" "\(String(data)); id: \(id); placeholders: \(placeholders); nsp: \(nsp)}"
@ -110,27 +111,12 @@ struct SocketPacket {
private func createPacketString() -> String { private func createPacketString() -> String {
let typeString = String(type.rawValue) let typeString = String(type.rawValue)
let binaryCountString: String // Binary count?
let nspString: String let binaryCountString = typeString + (type == .BinaryEvent || type == .BinaryAck ? String(binary.count) + "-" : "")
let idString: String // Namespace?
let nspString = binaryCountString + (nsp != "/" ? nsp + "," : "")
if type == .BinaryEvent || type == .BinaryAck { // Ack number?
binaryCountString = typeString + String(binary.count) + "-" let idString = nspString + (id != -1 ? String(id) : "")
} else {
binaryCountString = typeString
}
if nsp != "/" {
nspString = binaryCountString + nsp + ","
} else {
nspString = binaryCountString
}
if id != -1 {
idString = nspString + String(id)
} else {
idString = nspString
}
return completeMessage(idString) return completeMessage(idString)
} }

View File

@ -38,44 +38,46 @@ public protocol WebSocketPongDelegate: class {
func websocketDidReceivePong(socket: WebSocket) func websocketDidReceivePong(socket: WebSocket)
} }
public class WebSocket : NSObject, NSStreamDelegate { public class WebSocket: NSObject, NSStreamDelegate {
enum OpCode : UInt8 { enum OpCode: UInt8 {
case ContinueFrame = 0x0 case ContinueFrame = 0x0
case TextFrame = 0x1 case TextFrame = 0x1
case BinaryFrame = 0x2 case BinaryFrame = 0x2
//3-7 are reserved. // 3-7 are reserved.
case ConnectionClose = 0x8 case ConnectionClose = 0x8
case Ping = 0x9 case Ping = 0x9
case Pong = 0xA case Pong = 0xA
//B-F reserved. // B-F reserved.
} }
public enum CloseCode : UInt16 { public enum CloseCode: UInt16 {
case Normal = 1000 case Normal = 1000
case GoingAway = 1001 case GoingAway = 1001
case ProtocolError = 1002 case ProtocolError = 1002
case ProtocolUnhandledType = 1003 case ProtocolUnhandledType = 1003
// 1004 reserved. // 1004 reserved.
case NoStatusReceived = 1005 case NoStatusReceived = 1005
//1006 reserved. // 1006 reserved.
case Encoding = 1007 case Encoding = 1007
case PolicyViolated = 1008 case PolicyViolated = 1008
case MessageTooBig = 1009 case MessageTooBig = 1009
} }
public static let ErrorDomain = "WebSocket" public static let ErrorDomain = "WebSocket"
enum InternalErrorCode : UInt16 { enum InternalErrorCode: UInt16 {
// 0-999 WebSocket status codes not used // 0-999 WebSocket status codes not used
case OutputStreamWriteError = 1 case OutputStreamWriteError = 1
} }
//Where the callback is executed. It defaults to the main UI thread queue. /// Where the callback is executed. It defaults to the main UI thread queue.
public var queue = dispatch_get_main_queue() public var callbackQueue = dispatch_get_main_queue()
var optionalProtocols : [String]? var optionalProtocols : [String]?
//Constant Values.
// MARK: - Constants
let headerWSUpgradeName = "Upgrade" let headerWSUpgradeName = "Upgrade"
let headerWSUpgradeValue = "websocket" let headerWSUpgradeValue = "websocket"
let headerWSHostName = "Host" let headerWSHostName = "Host"
@ -94,6 +96,8 @@ public class WebSocket : NSObject, NSStreamDelegate {
let MaskMask: UInt8 = 0x80 let MaskMask: UInt8 = 0x80
let PayloadLenMask: UInt8 = 0x7F let PayloadLenMask: UInt8 = 0x7F
let MaxFrameSize: Int = 32 let MaxFrameSize: Int = 32
let httpSwitchProtocolCode = 101
let supportedSSLSchemes = ["wss", "https"]
class WSResponse { class WSResponse {
var isFin = false var isFin = false
@ -103,13 +107,24 @@ public class WebSocket : NSObject, NSStreamDelegate {
var buffer: NSMutableData? var buffer: NSMutableData?
} }
// MARK: - Delegates
/// Responds to callback about new messages coming in over the WebSocket
/// and also connection/disconnect messages.
public weak var delegate: WebSocketDelegate? public weak var delegate: WebSocketDelegate?
/// Recives a callback for each pong message recived.
public weak var pongDelegate: WebSocketPongDelegate? public weak var pongDelegate: WebSocketPongDelegate?
// MARK: - Block based API.
public var onConnect: ((Void) -> Void)? public var onConnect: ((Void) -> Void)?
public var onDisconnect: ((NSError?) -> Void)? public var onDisconnect: ((NSError?) -> Void)?
public var onText: ((String) -> Void)? public var onText: ((String) -> Void)?
public var onData: ((NSData) -> Void)? public var onData: ((NSData) -> Void)?
public var onPong: ((Void) -> Void)? public var onPong: ((Void) -> Void)?
public var headers = [String: String]() public var headers = [String: String]()
public var voipEnabled = false public var voipEnabled = false
public var selfSignedSSL = false public var selfSignedSSL = false
@ -120,12 +135,15 @@ public class WebSocket : NSObject, NSStreamDelegate {
public var isConnected :Bool { public var isConnected :Bool {
return connected return connected
} }
public var currentURL: NSURL {return url} public var currentURL: NSURL { return url }
// MARK: - Private
private var url: NSURL private var url: NSURL
private var inputStream: NSInputStream? private var inputStream: NSInputStream?
private var outputStream: NSOutputStream? private var outputStream: NSOutputStream?
private var connected = false private var connected = false
private var isCreated = false private var isConnecting = false
private var writeQueue = NSOperationQueue() private var writeQueue = NSOperationQueue()
private var readStack = [WSResponse]() private var readStack = [WSResponse]()
private var inputQueue = [NSData]() private var inputQueue = [NSData]()
@ -141,10 +159,11 @@ public class WebSocket : NSObject, NSStreamDelegate {
mutex.unlock() mutex.unlock()
return canWork return canWork
} }
//the shared processing queue used for all websocket
/// The shared processing queue used for all WebSocket.
private static let sharedWorkQueue = dispatch_queue_create("com.vluxe.starscream.websocket", DISPATCH_QUEUE_SERIAL) private static let sharedWorkQueue = dispatch_queue_create("com.vluxe.starscream.websocket", DISPATCH_QUEUE_SERIAL)
//used for setting protocols. /// Used for setting protocols.
public init(url: NSURL, protocols: [String]? = nil) { public init(url: NSURL, protocols: [String]? = nil) {
self.url = url self.url = url
self.origin = url.absoluteString self.origin = url.absoluteString
@ -152,13 +171,13 @@ public class WebSocket : NSObject, NSStreamDelegate {
optionalProtocols = protocols optionalProtocols = protocols
} }
///Connect to the websocket server on a background thread /// Connect to the WebSocket server on a background thread.
public func connect() { public func connect() {
guard !isCreated else { return } guard !isConnecting else { return }
didDisconnect = false didDisconnect = false
isCreated = true isConnecting = true
createHTTPRequest() createHTTPRequest()
isCreated = false isConnecting = false
} }
/** /**
@ -173,7 +192,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
public func disconnect(forceTimeout forceTimeout: NSTimeInterval? = nil) { public func disconnect(forceTimeout forceTimeout: NSTimeInterval? = nil) {
switch forceTimeout { switch forceTimeout {
case .Some(let seconds) where seconds > 0: case .Some(let seconds) where seconds > 0:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(seconds * Double(NSEC_PER_SEC))), queue) { [weak self] in dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(seconds * Double(NSEC_PER_SEC))), callbackQueue) { [weak self] in
self?.disconnectStream(nil) self?.disconnectStream(nil)
} }
fallthrough fallthrough
@ -181,7 +200,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
writeError(CloseCode.Normal.rawValue) writeError(CloseCode.Normal.rawValue)
default: default:
self.disconnectStream(nil) disconnectStream(nil)
break break
} }
} }
@ -212,14 +231,14 @@ public class WebSocket : NSObject, NSStreamDelegate {
dequeueWrite(data, code: .BinaryFrame, writeCompletion: completion) dequeueWrite(data, code: .BinaryFrame, writeCompletion: completion)
} }
//write a ping to the websocket. This sends it as a control frame. // Write a ping to the websocket. This sends it as a control frame.
//yodel a sound to the planet. This sends it as an astroid. http://youtu.be/Eu5ZJELRiJ8?t=42s // Yodel a sound to the planet. This sends it as an astroid. http://youtu.be/Eu5ZJELRiJ8?t=42s
public func writePing(data: NSData, completion: (() -> ())? = nil) { public func writePing(data: NSData, completion: (() -> ())? = nil) {
guard isConnected else { return } guard isConnected else { return }
dequeueWrite(data, code: .Ping, writeCompletion: completion) dequeueWrite(data, code: .Ping, writeCompletion: completion)
} }
//private method that starts the connection /// Private method that starts the connection.
private func createHTTPRequest() { private func createHTTPRequest() {
let urlRequest = CFHTTPMessageCreateRequest(kCFAllocatorDefault, "GET", let urlRequest = CFHTTPMessageCreateRequest(kCFAllocatorDefault, "GET",
@ -227,7 +246,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
var port = url.port var port = url.port
if port == nil { if port == nil {
if ["wss", "https"].contains(url.scheme) { if supportedSSLSchemes.contains(url.scheme) {
port = 443 port = 443
} else { } else {
port = 80 port = 80
@ -253,12 +272,12 @@ public class WebSocket : NSObject, NSStreamDelegate {
} }
} }
//Add a header to the CFHTTPMessage by using the NSString bridges to CFString /// Add a header to the CFHTTPMessage by using the NSString bridges to CFString.
private func addHeader(urlRequest: CFHTTPMessage, key: NSString, val: NSString) { private func addHeader(urlRequest: CFHTTPMessage, key: NSString, val: NSString) {
CFHTTPMessageSetHeaderFieldValue(urlRequest, key, val) CFHTTPMessageSetHeaderFieldValue(urlRequest, key, val)
} }
//generate a websocket key as needed in rfc /// Generate a WebSocket key as needed in RFC.
private func generateWebSocketKey() -> String { private func generateWebSocketKey() -> String {
var key = "" var key = ""
let seed = 16 let seed = 16
@ -271,7 +290,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
return baseKey! return baseKey!
} }
//Start the stream connection and write the data to the output stream /// Start the stream connection and write the data to the output stream.
private func initStreamsWithData(data: NSData, _ port: Int) { private func initStreamsWithData(data: NSData, _ port: Int) {
//higher level API we will cut over to at some point //higher level API we will cut over to at some point
//NSStream.getStreamsToHostWithName(url.host, port: url.port.integerValue, inputStream: &inputStream, outputStream: &outputStream) //NSStream.getStreamsToHostWithName(url.host, port: url.port.integerValue, inputStream: &inputStream, outputStream: &outputStream)
@ -285,7 +304,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
guard let inStream = inputStream, let outStream = outputStream else { return } guard let inStream = inputStream, let outStream = outputStream else { return }
inStream.delegate = self inStream.delegate = self
outStream.delegate = self outStream.delegate = self
if ["wss", "https"].contains(url.scheme) { if supportedSSLSchemes.contains(url.scheme) {
inStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey) inStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)
outStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey) outStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)
} else { } else {
@ -296,7 +315,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
outStream.setProperty(NSStreamNetworkServiceTypeVoIP, forKey: NSStreamNetworkServiceType) outStream.setProperty(NSStreamNetworkServiceTypeVoIP, forKey: NSStreamNetworkServiceType)
} }
if selfSignedSSL { if selfSignedSSL {
let settings: [NSObject: NSObject] = [kCFStreamSSLValidatesCertificateChain: NSNumber(bool:false), kCFStreamSSLPeerName: kCFNull] let settings: [NSObject: NSObject] = [kCFStreamSSLValidatesCertificateChain: NSNumber(bool: false), kCFStreamSSLPeerName: kCFNull]
inStream.setProperty(settings, forKey: kCFStreamPropertySSLSettings as String) inStream.setProperty(settings, forKey: kCFStreamPropertySSLSettings as String)
outStream.setProperty(settings, forKey: kCFStreamPropertySSLSettings as String) outStream.setProperty(settings, forKey: kCFStreamPropertySSLSettings as String)
} }
@ -327,23 +346,24 @@ public class WebSocket : NSObject, NSStreamDelegate {
self.mutex.unlock() self.mutex.unlock()
let bytes = UnsafePointer<UInt8>(data.bytes) let bytes = UnsafePointer<UInt8>(data.bytes)
var out = timeout * 1000000 //wait 5 seconds before giving up var out = timeout * 1000000 // wait 5 seconds before giving up
writeQueue.addOperationWithBlock { [weak self] in writeQueue.addOperationWithBlock { [weak self] in
while !outStream.hasSpaceAvailable { while !outStream.hasSpaceAvailable {
usleep(100) //wait until the socket is ready usleep(100) // wait until the socket is ready
out -= 100 out -= 100
if out < 0 { if out < 0 {
self?.cleanupStream() self?.cleanupStream()
self?.doDisconnect(self?.errorWithDetail("write wait timed out", code: 2)) self?.doDisconnect(self?.errorWithDetail("write wait timed out", code: 2))
return return
} else if outStream.streamError != nil { } else if outStream.streamError != nil {
return //disconnectStream will be called. return // disconnectStream will be called.
} }
} }
outStream.write(bytes, maxLength: data.length) outStream.write(bytes, maxLength: data.length)
} }
} }
//delegate for the stream methods. Processes incoming bytes
// Delegate for the stream methods. Processes incoming bytes.
public func stream(aStream: NSStream, handleEvent eventCode: NSStreamEvent) { public func stream(aStream: NSStream, handleEvent eventCode: NSStreamEvent) {
if let sec = security where !certValidated && [.HasBytesAvailable, .HasSpaceAvailable].contains(eventCode) { if let sec = security where !certValidated && [.HasBytesAvailable, .HasSpaceAvailable].contains(eventCode) {
@ -369,7 +389,8 @@ public class WebSocket : NSObject, NSStreamDelegate {
disconnectStream(nil) disconnectStream(nil)
} }
} }
//disconnect the stream object
/// Disconnect the stream object and notifies the delegate.
private func disconnectStream(error: NSError?) { private func disconnectStream(error: NSError?) {
if error == nil { if error == nil {
writeQueue.waitUntilAllOperationsAreFinished() writeQueue.waitUntilAllOperationsAreFinished()
@ -395,7 +416,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
inputStream = nil inputStream = nil
} }
///handles the incoming bytes and sending them to the proper processing method /// Handles the incoming bytes and sending them to the proper processing method.
private func processInputStream() { private func processInputStream() {
let buf = NSMutableData(capacity: BUFFER_MAX) let buf = NSMutableData(capacity: BUFFER_MAX)
let buffer = UnsafeMutablePointer<UInt8>(buf!.bytes) let buffer = UnsafeMutablePointer<UInt8>(buf!.bytes)
@ -411,7 +432,8 @@ public class WebSocket : NSObject, NSStreamDelegate {
dequeueInput() dequeueInput()
} }
} }
///dequeue the incoming input so it is processed in order
/// Dequeue the incoming input so it is processed in order.
private func dequeueInput() { private func dequeueInput() {
while !inputQueue.isEmpty { while !inputQueue.isEmpty {
let data = inputQueue[0] let data = inputQueue[0]
@ -429,18 +451,18 @@ public class WebSocket : NSObject, NSStreamDelegate {
} else { } else {
processRawMessagesInBuffer(buffer, bufferLen: length) processRawMessagesInBuffer(buffer, bufferLen: length)
} }
inputQueue = inputQueue.filter{$0 != data} inputQueue = inputQueue.filter{ $0 != data }
} }
} }
//handle checking the inital connection status // Handle checking the initial connection status.
private func processTCPHandshake(buffer: UnsafePointer<UInt8>, bufferLen: Int) { private func processTCPHandshake(buffer: UnsafePointer<UInt8>, bufferLen: Int) {
let code = processHTTP(buffer, bufferLen: bufferLen) let code = processHTTP(buffer, bufferLen: bufferLen)
switch code { switch code {
case 0: case 0:
connected = true connected = true
guard canDispatch else {return} guard canDispatch else {return}
dispatch_async(queue) { [weak self] in dispatch_async(callbackQueue) { [weak self] in
guard let s = self else { return } guard let s = self else { return }
s.onConnect?() s.onConnect?()
s.delegate?.websocketDidConnect(s) s.delegate?.websocketDidConnect(s)
@ -448,12 +470,13 @@ public class WebSocket : NSObject, NSStreamDelegate {
} }
case -1: case -1:
fragBuffer = NSData(bytes: buffer, length: bufferLen) fragBuffer = NSData(bytes: buffer, length: bufferLen)
break //do nothing, we are going to collect more data break // do nothing, we are going to collect more data
default: default:
doDisconnect(errorWithDetail("Invalid HTTP upgrade", code: UInt16(code))) doDisconnect(errorWithDetail("Invalid HTTP upgrade", code: UInt16(code)))
} }
} }
///Finds the HTTP Packet in the TCP stream, by looking for the CRLF.
/// Finds the HTTP Packet in the TCP stream, by looking for the CRLF.
private func processHTTP(buffer: UnsafePointer<UInt8>, bufferLen: Int) -> Int { private func processHTTP(buffer: UnsafePointer<UInt8>, bufferLen: Int) -> Int {
let CRLFBytes = [UInt8(ascii: "\r"), UInt8(ascii: "\n"), UInt8(ascii: "\r"), UInt8(ascii: "\n")] let CRLFBytes = [UInt8(ascii: "\r"), UInt8(ascii: "\n"), UInt8(ascii: "\r"), UInt8(ascii: "\n")]
var k = 0 var k = 0
@ -481,15 +504,15 @@ public class WebSocket : NSObject, NSStreamDelegate {
} }
return 0 //success return 0 //success
} }
return -1 //was unable to find the full TCP header return -1 // Was unable to find the full TCP header.
} }
///validates the HTTP is a 101 as per the RFC spec /// Validates the HTTP is a 101 as per the RFC spec.
private func validateResponse(buffer: UnsafePointer<UInt8>, bufferLen: Int) -> Int { private func validateResponse(buffer: UnsafePointer<UInt8>, bufferLen: Int) -> Int {
let response = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, false).takeRetainedValue() let response = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, false).takeRetainedValue()
CFHTTPMessageAppendBytes(response, buffer, bufferLen) CFHTTPMessageAppendBytes(response, buffer, bufferLen)
let code = CFHTTPMessageGetResponseStatusCode(response) let code = CFHTTPMessageGetResponseStatusCode(response)
if code != 101 { if code != httpSwitchProtocolCode {
return code return code
} }
if let cfHeaders = CFHTTPMessageCopyAllHeaderFields(response) { if let cfHeaders = CFHTTPMessageCopyAllHeaderFields(response) {
@ -503,12 +526,12 @@ public class WebSocket : NSObject, NSStreamDelegate {
return -1 return -1
} }
///read a 16 bit big endian value from a buffer ///read a 16-bit big endian value from a buffer
private static func readUint16(buffer: UnsafePointer<UInt8>, offset: Int) -> UInt16 { private static func readUint16(buffer: UnsafePointer<UInt8>, offset: Int) -> UInt16 {
return (UInt16(buffer[offset + 0]) << 8) | UInt16(buffer[offset + 1]) return (UInt16(buffer[offset + 0]) << 8) | UInt16(buffer[offset + 1])
} }
///read a 64 bit big endian value from a buffer ///read a 64-bit big endian value from a buffer
private static func readUint64(buffer: UnsafePointer<UInt8>, offset: Int) -> UInt64 { private static func readUint64(buffer: UnsafePointer<UInt8>, offset: Int) -> UInt64 {
var value = UInt64(0) var value = UInt64(0)
for i in 0...7 { for i in 0...7 {
@ -517,13 +540,13 @@ public class WebSocket : NSObject, NSStreamDelegate {
return value return value
} }
///write a 16 bit big endian value to a buffer /// Write a 16-bit big endian value to a buffer.
private static func writeUint16(buffer: UnsafeMutablePointer<UInt8>, offset: Int, value: UInt16) { private static func writeUint16(buffer: UnsafeMutablePointer<UInt8>, offset: Int, value: UInt16) {
buffer[offset + 0] = UInt8(value >> 8) buffer[offset + 0] = UInt8(value >> 8)
buffer[offset + 1] = UInt8(value & 0xff) buffer[offset + 1] = UInt8(value & 0xff)
} }
///write a 64 bit big endian value to a buffer /// Write a 64-bit big endian value to a buffer.
private static func writeUint64(buffer: UnsafeMutablePointer<UInt8>, offset: Int, value: UInt64) { private static func writeUint64(buffer: UnsafeMutablePointer<UInt8>, offset: Int, value: UInt64) {
for i in 0...7 { for i in 0...7 {
buffer[offset + i] = UInt8((value >> (8*UInt64(7 - i))) & 0xff) buffer[offset + i] = UInt8((value >> (8*UInt64(7 - i))) & 0xff)
@ -588,17 +611,19 @@ public class WebSocket : NSObject, NSStreamDelegate {
} }
offset += 2 offset += 2
} }
var closeReason = "connection closed by server"
if payloadLen > 2 { if payloadLen > 2 {
let len = Int(payloadLen-2) let len = Int(payloadLen - 2)
if len > 0 { if len > 0 {
let bytes = baseAddress + offset let bytes = baseAddress + offset
let str: NSString? = NSString(data: NSData(bytes: bytes, length: len), encoding: NSUTF8StringEncoding) if let customCloseReason = String(data: NSData(bytes: bytes, length: len), encoding: NSUTF8StringEncoding) {
if str == nil { closeReason = customCloseReason
} else {
code = CloseCode.ProtocolError.rawValue code = CloseCode.ProtocolError.rawValue
} }
} }
} }
doDisconnect(errorWithDetail("connection closed by server", code: code)) doDisconnect(errorWithDetail(closeReason, code: code))
writeError(code) writeError(code)
return emptyBuffer return emptyBuffer
} }
@ -631,7 +656,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
} }
if receivedOpcode == .Pong { if receivedOpcode == .Pong {
if canDispatch { if canDispatch {
dispatch_async(queue) { [weak self] in dispatch_async(callbackQueue) { [weak self] in
guard let s = self else { return } guard let s = self else { return }
s.onPong?() s.onPong?()
s.pongDelegate?.websocketDidReceivePong(s) s.pongDelegate?.websocketDidReceivePong(s)
@ -641,7 +666,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
} }
var response = readStack.last var response = readStack.last
if isControlFrame { if isControlFrame {
response = nil //don't append pings response = nil // Don't append pings.
} }
if isFin == 0 && receivedOpcode == .ContinueFrame && response == nil { if isFin == 0 && receivedOpcode == .ContinueFrame && response == nil {
let errCode = CloseCode.ProtocolError.rawValue let errCode = CloseCode.ProtocolError.rawValue
@ -685,7 +710,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
processResponse(response) processResponse(response)
} }
let step = Int(offset+numericCast(len)) let step = Int(offset + numericCast(len))
return buffer.fromOffset(step) return buffer.fromOffset(step)
} }
} }
@ -701,11 +726,11 @@ public class WebSocket : NSObject, NSStreamDelegate {
} }
} }
///process the finished response of a buffer /// Process the finished response of a buffer.
private func processResponse(response: WSResponse) -> Bool { private func processResponse(response: WSResponse) -> Bool {
if response.isFin && response.bytesLeft <= 0 { if response.isFin && response.bytesLeft <= 0 {
if response.code == .Ping { if response.code == .Ping {
let data = response.buffer! //local copy so it is perverse for writing let data = response.buffer! // local copy so it's not perverse for writing
dequeueWrite(data, code: OpCode.Pong) dequeueWrite(data, code: OpCode.Pong)
} else if response.code == .TextFrame { } else if response.code == .TextFrame {
let str: NSString? = NSString(data: response.buffer!, encoding: NSUTF8StringEncoding) let str: NSString? = NSString(data: response.buffer!, encoding: NSUTF8StringEncoding)
@ -714,7 +739,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
return false return false
} }
if canDispatch { if canDispatch {
dispatch_async(queue) { [weak self] in dispatch_async(callbackQueue) { [weak self] in
guard let s = self else { return } guard let s = self else { return }
s.onText?(str! as String) s.onText?(str! as String)
s.delegate?.websocketDidReceiveMessage(s, text: str! as String) s.delegate?.websocketDidReceiveMessage(s, text: str! as String)
@ -722,8 +747,8 @@ public class WebSocket : NSObject, NSStreamDelegate {
} }
} else if response.code == .BinaryFrame { } else if response.code == .BinaryFrame {
if canDispatch { if canDispatch {
let data = response.buffer! //local copy so it is perverse for writing let data = response.buffer! //local copy so it's not perverse for writing
dispatch_async(queue) { [weak self] in dispatch_async(callbackQueue) { [weak self] in
guard let s = self else { return } guard let s = self else { return }
s.onData?(data) s.onData?(data)
s.delegate?.websocketDidReceiveData(s, data: data) s.delegate?.websocketDidReceiveData(s, data: data)
@ -736,21 +761,22 @@ public class WebSocket : NSObject, NSStreamDelegate {
return false return false
} }
///Create an error /// Create an error.
private func errorWithDetail(detail: String, code: UInt16) -> NSError { private func errorWithDetail(detail: String, code: UInt16) -> NSError {
var details = [String: String]() var details = [String: String]()
details[NSLocalizedDescriptionKey] = detail details[NSLocalizedDescriptionKey] = detail
return NSError(domain: WebSocket.ErrorDomain, code: Int(code), userInfo: details) return NSError(domain: WebSocket.ErrorDomain, code: Int(code), userInfo: details)
} }
///write a an error to the socket /// Write a an error to the socket.
private func writeError(code: UInt16) { private func writeError(code: UInt16) {
let buf = NSMutableData(capacity: sizeof(UInt16)) let buf = NSMutableData(capacity: sizeof(UInt16))
let buffer = UnsafeMutablePointer<UInt8>(buf!.bytes) let buffer = UnsafeMutablePointer<UInt8>(buf!.bytes)
WebSocket.writeUint16(buffer, offset: 0, value: code) WebSocket.writeUint16(buffer, offset: 0, value: code)
dequeueWrite(NSData(bytes: buffer, length: sizeof(UInt16)), code: .ConnectionClose) dequeueWrite(NSData(bytes: buffer, length: sizeof(UInt16)), code: .ConnectionClose)
} }
///used to write things to the stream
/// Used to write things to the stream.
private func dequeueWrite(data: NSData, code: OpCode, writeCompletion: (() -> ())? = nil) { private func dequeueWrite(data: NSData, code: OpCode, writeCompletion: (() -> ())? = nil) {
writeQueue.addOperationWithBlock { [weak self] in writeQueue.addOperationWithBlock { [weak self] in
//stream isn't ready, let's wait //stream isn't ready, let's wait
@ -800,8 +826,8 @@ public class WebSocket : NSObject, NSStreamDelegate {
total += len total += len
} }
if total >= offset { if total >= offset {
if let queue = self?.queue, callback = writeCompletion { if let callbackQueue = self?.callbackQueue, callback = writeCompletion {
dispatch_async(queue) { dispatch_async(callbackQueue) {
callback() callback()
} }
} }
@ -813,21 +839,23 @@ public class WebSocket : NSObject, NSStreamDelegate {
} }
} }
///used to preform the disconnect delegate /// Used to preform the disconnect delegate.
private func doDisconnect(error: NSError?) { private func doDisconnect(error: NSError?) {
guard !didDisconnect else { return } guard !didDisconnect else { return }
didDisconnect = true didDisconnect = true
connected = false connected = false
guard canDispatch else {return} guard canDispatch else {return}
dispatch_async(queue) { [weak self] in dispatch_async(callbackQueue) { [weak self] in
guard let s = self else { return } guard let s = self else { return }
s.onDisconnect?(error) s.onDisconnect?(error)
s.delegate?.websocketDidDisconnect(s, error: error) s.delegate?.websocketDidDisconnect(s, error: error)
let userInfo = error.map({ [WebsocketDisconnectionErrorKeyName: $0] }) let userInfo = error.map{ [WebsocketDisconnectionErrorKeyName: $0] }
s.notificationCenter.postNotificationName(WebsocketDidDisconnectNotification, object: self, userInfo: userInfo) s.notificationCenter.postNotificationName(WebsocketDidDisconnectNotification, object: self, userInfo: userInfo)
} }
} }
// MARK: - Deinit
deinit { deinit {
mutex.lock() mutex.lock()
readyToWrite = false readyToWrite = false