Skip to content

Commit 6b80f75

Browse files
committed
Merge branch 'development'
* development: Update and gen docs prepare podspec for release Regenerate docs update docs, remove other prints remove print Support both v2 and v3 Start working on migration guide update docs Add ability to send payload with connect more CocoaPods testing CocoaPods testing Fix tests Better timeouts Support socket.io 3 + starscream 4 update examples for new operator Add some helpful operators fix swift syntax highlighting show how to test for ack timeouts
2 parents 9433f60 + bdcdddf commit 6b80f75

File tree

81 files changed

+5431
-2251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+5431
-2251
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: objective-c
22
xcode_project: Socket.IO-Client-Swift.xcodeproj # path to your xcodeproj folder
33
xcode_scheme: SocketIO-Mac
4-
osx_image: xcode11.2
4+
osx_image: xcode12.2
55
branches:
66
only:
77
- master

Diff for: CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# v16.0.0
2+
3+
- Removed Objective-C support. It's time for you to embrace Swift.
4+
- Socket.io 3 support.
5+
6+
# v15.3.0
7+
8+
- Add `==` operators for `SocketAckStatus` and `String`
9+
110
# v15.2.0
211

312
- Small fixes.

Diff for: Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "daltoniam/Starscream" ~> 3.1
1+
github "daltoniam/Starscream" ~> 4.0

Diff for: Cartfile.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "daltoniam/Starscream" "3.1.0"
1+
github "daltoniam/Starscream" "4.0.4"

Diff for: Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"repositoryURL": "https://github.com/daltoniam/Starscream",
77
"state": {
88
"branch": null,
9-
"revision": "9c03ef715d1bc9334b446c90df53586dd38cf849",
10-
"version": "3.1.0"
9+
"revision": "df8d82047f6654d8e4b655d1b1525c64e1059d21",
10+
"version": "4.0.4"
1111
}
1212
}
1313
]

Diff for: Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.0
1+
// swift-tools-version:5.3
22

33
import PackageDescription
44

@@ -8,7 +8,7 @@ let package = Package(
88
.library(name: "SocketIO", targets: ["SocketIO"])
99
],
1010
dependencies: [
11-
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.1.0")),
11+
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "4.0.0")),
1212
],
1313
targets: [
1414
.target(name: "SocketIO", dependencies: ["Starscream"]),

Diff for: README.md

+8-33
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ socket.on("currentAmount") {data, ack in
1818
guard let cur = data[0] as? Double else { return }
1919

2020
socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in
21+
if data.first as? String ?? "passed" == SocketAckValue.noAck {
22+
// Handle ack timeout
23+
}
24+
2125
socket.emit("update", ["amount": cur + 2.50])
2226
}
2327

@@ -27,52 +31,23 @@ socket.on("currentAmount") {data, ack in
2731
socket.connect()
2832
```
2933

30-
## Objective-C Example
31-
```objective-c
32-
@import SocketIO;
33-
34-
NSURL* url = [[NSURL alloc] initWithString:@"http://localhost:8080"];
35-
SocketManager* manager = [[SocketManager alloc] initWithSocketURL:url config:@{@"log": @YES, @"compress": @YES}];
36-
SocketIOClient* socket = manager.defaultSocket;
37-
38-
[socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
39-
NSLog(@"socket connected");
40-
}];
41-
42-
[socket on:@"currentAmount" callback:^(NSArray* data, SocketAckEmitter* ack) {
43-
double cur = [[data objectAtIndex:0] floatValue];
44-
45-
[[socket emitWithAck:@"canUpdate" with:@[@(cur)]] timingOutAfter:0 callback:^(NSArray* data) {
46-
[socket emit:@"update" with:@[@{@"amount": @(cur + 2.50)}]];
47-
}];
48-
49-
[ack with:@[@"Got your currentAmount, ", @"dude"]];
50-
}];
51-
52-
[socket connect];
53-
54-
```
55-
5634
## Features
57-
- Supports socket.io 2.0+ (For socket.io 1.0 use v9.x)
58-
- Supports binary
35+
- Supports socket.io 2.0+/3.0+.
36+
- Supports Binary
5937
- Supports Polling and WebSockets
6038
- Supports TLS/SSL
61-
- Can be used from Objective-C
6239

6340
## FAQS
6441
Checkout the [FAQs](https://nuclearace.github.io/Socket.IO-Client-Swift/faq.html) for commonly asked questions.
6542

43+
6644
Checkout the [12to13](https://nuclearace.github.io/Socket.IO-Client-Swift/12to13.html) guide for migrating to v13+ from v12 below.
6745

46+
Checkout the [15to16](https://nuclearace.github.io/Socket.IO-Client-Swift/15to16.html) guide for migrating to v16+ from v15.
6847

6948
## Installation
7049
Requires Swift 4/5 and Xcode 10.x
7150

72-
If you need Swift 2.3 use the [swift2.3 tag](https://github.com/socketio/socket.io-client-swift/releases/tag/swift2.3) (Pre-Swift 4 support is no longer maintained)
73-
74-
If you need Swift 3.x use v11.1.3.
75-
7651
### Swift Package Manager
7752
Add the project as a dependency to your Package.swift:
7853
```swift

Diff for: Socket.IO-Client-Swift.podspec

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
Pod::Spec.new do |s|
22
s.name = "Socket.IO-Client-Swift"
33
s.module_name = "SocketIO"
4-
s.version = "15.2.0"
4+
s.version = "16.0.0"
55
s.summary = "Socket.IO-client for iOS and OS X"
66
s.description = <<-DESC
77
Socket.IO-client for iOS and OS X.
88
Supports ws/wss/polling connections and binary.
9-
For socket.io 2.0+ and Swift.
9+
For socket.io 3.0+ and Swift.
1010
DESC
1111
s.homepage = "https://github.com/socketio/socket.io-client-swift"
1212
s.license = { :type => 'MIT' }
1313
s.author = { "Erik" => "[email protected]" }
14-
s.ios.deployment_target = '8.0'
15-
s.osx.deployment_target = '10.10'
16-
s.tvos.deployment_target = '9.0'
17-
s.watchos.deployment_target = '2.0'
14+
s.ios.deployment_target = '10.0'
15+
s.osx.deployment_target = '10.13'
16+
s.tvos.deployment_target = '10.0'
17+
s.watchos.deployment_target = '5.0'
1818
s.requires_arc = true
1919
s.source = {
2020
:git => "https://github.com/socketio/socket.io-client-swift.git",
21-
:tag => 'v15.2.0',
21+
:tag => 'v16.0.0',
2222
:submodules => true
2323
}
2424

@@ -27,5 +27,5 @@ Pod::Spec.new do |s|
2727
'SWIFT_VERSION' => '5.0'
2828
}
2929
s.source_files = "Source/SocketIO/**/*.swift", "Source/SocketIO/*.swift"
30-
s.dependency "Starscream", "~> 3.1"
30+
s.dependency "Starscream", "~> 4.0"
3131
end

Diff for: Socket.IO-Client-Swift.xcodeproj/project.pbxproj

+8-14
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
1C686BE61F869AFD007D8627 /* SocketAckManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BD61F869AF1007D8627 /* SocketAckManagerTest.swift */; };
1919
1C686BE71F869AFD007D8627 /* SocketParserTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BD71F869AF1007D8627 /* SocketParserTest.swift */; };
2020
1C686BE81F869AFD007D8627 /* SocketNamespacePacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BD81F869AF1007D8627 /* SocketNamespacePacketTest.swift */; };
21-
1C686C001F869EAE007D8627 /* SocketObjectiveCTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BFE1F869E9D007D8627 /* SocketObjectiveCTest.m */; };
2221
572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */; };
2322
6CA08A981D615C0B0061FD2A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA08A971D615C0B0061FD2A /* Security.framework */; };
2423
74BF53581F894326004972D8 /* SocketIO.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF23C1B51F18A00EEBB58 /* SocketIO.h */; settings = {ATTRIBUTES = (Public, ); }; };
2524
74D0F5961F8053950037C4DC /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9432E00B1F77F883006AF628 /* Starscream.framework */; };
2625
74DA21741F09440F009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21731F09440F009C19EE /* libz.tbd */; };
2726
74DA217C1F09457B009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21731F09440F009C19EE /* libz.tbd */; };
28-
9432E00F1F77F8C4006AF628 /* SSLSecurity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9432E0061F77F7CA006AF628 /* SSLSecurity.swift */; };
2927
DD52B048C71D724ABBD18C71 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52BDC9E66AADA2CC5E8246 /* SocketTypes.swift */; };
3028
DD52B11AF936352BAE30B2C8 /* SocketStringReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52BA240D139F72633D4159 /* SocketStringReader.swift */; };
3129
DD52B1F8BA0455EBE7C1B93E /* SocketAckEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52BFF2E3216CDC364BB8AF /* SocketAckEmitter.swift */; };
@@ -34,7 +32,6 @@
3432
DD52B3A6C1E082841C35C85D /* SocketEngineClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52BE5FDCE1D684132E897C /* SocketEngineClient.swift */; };
3533
DD52B44AE56F2E07F3F3F991 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52B09F7984E730513AB7E5 /* SocketAckManager.swift */; };
3634
DD52B4DFA12F2599410205D9 /* SocketEngineWebsocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52BE9AD8B2BD7F841CD1D4 /* SocketEngineWebsocket.swift */; };
37-
DD52B53F2609D91A683DFCDD /* ManagerObjectiveCTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52BB5E907D283ACC31E17F /* ManagerObjectiveCTest.m */; };
3835
DD52B56DE03CDB4F40BD1A23 /* SocketExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52B471D780013E18DF9335 /* SocketExtensions.swift */; };
3936
DD52B57E7ABC61B57EE2A4B8 /* SocketPacket.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52B59C11D3D2BC63612E50 /* SocketPacket.swift */; };
4037
DD52B883F942CD5A9D29892B /* SocketEnginePollable.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52B2D110F55723F82B108E /* SocketEnginePollable.swift */; };
@@ -474,7 +471,6 @@
474471
DD52BB69B6D260035B652CA4 /* SocketAnyEvent.swift in Sources */,
475472
DD52BF924BEF05E1235CFD29 /* SocketIOClient.swift in Sources */,
476473
DD52BFEB4DBD3BF8D93DAEFF /* SocketEventHandler.swift in Sources */,
477-
9432E00F1F77F8C4006AF628 /* SSLSecurity.swift in Sources */,
478474
DD52BB9A3E42FF2DD6BE7C2F /* SocketIOClientSpec.swift in Sources */,
479475
DD52B2AFE7D46039C7AE4D19 /* SocketIOClientOption.swift in Sources */,
480476
DD52BE4D1E6BB752CD9614A6 /* SocketIOStatus.swift in Sources */,
@@ -495,7 +491,6 @@
495491
isa = PBXSourcesBuildPhase;
496492
buildActionMask = 2147483647;
497493
files = (
498-
1C686C001F869EAE007D8627 /* SocketObjectiveCTest.m in Sources */,
499494
1C686BE21F869AFD007D8627 /* SocketIOClientConfigurationTest.swift in Sources */,
500495
1C686BE31F869AFD007D8627 /* SocketEngineTest.swift in Sources */,
501496
1C686BE41F869AFD007D8627 /* SocketSideEffectTest.swift in Sources */,
@@ -504,7 +499,6 @@
504499
1C686BE71F869AFD007D8627 /* SocketParserTest.swift in Sources */,
505500
1C686BE81F869AFD007D8627 /* SocketNamespacePacketTest.swift in Sources */,
506501
DD52BCCD25EFA76E0F9B313C /* SocketMangerTest.swift in Sources */,
507-
DD52B53F2609D91A683DFCDD /* ManagerObjectiveCTest.m in Sources */,
508502
1C657CDE5D510E8E2E573E39 /* utils.swift in Sources */,
509503
);
510504
runOnlyForDeploymentPostprocessing = 0;
@@ -583,16 +577,16 @@
583577
GCC_WARN_UNINITIALIZED_AUTOS = YES;
584578
GCC_WARN_UNUSED_FUNCTION = YES;
585579
GCC_WARN_UNUSED_VARIABLE = YES;
586-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
587-
MACOSX_DEPLOYMENT_TARGET = 10.10;
580+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
581+
MACOSX_DEPLOYMENT_TARGET = 10.14;
588582
ONLY_ACTIVE_ARCH = YES;
589583
PRODUCT_NAME = SocketIO;
590584
SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator";
591585
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
592586
SWIFT_VERSION = 5.0;
593-
TVOS_DEPLOYMENT_TARGET = 9.0;
587+
TVOS_DEPLOYMENT_TARGET = 10.0;
594588
VALID_ARCHS = "i386 x86_64 armv7 armv7s arm64 armv7k";
595-
WATCHOS_DEPLOYMENT_TARGET = 2.0;
589+
WATCHOS_DEPLOYMENT_TARGET = 7.0;
596590
};
597591
name = Debug;
598592
};
@@ -657,15 +651,15 @@
657651
GCC_WARN_UNINITIALIZED_AUTOS = YES;
658652
GCC_WARN_UNUSED_FUNCTION = YES;
659653
GCC_WARN_UNUSED_VARIABLE = YES;
660-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
661-
MACOSX_DEPLOYMENT_TARGET = 10.10;
654+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
655+
MACOSX_DEPLOYMENT_TARGET = 10.14;
662656
PRODUCT_NAME = SocketIO;
663657
SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator";
664658
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
665659
SWIFT_VERSION = 5.0;
666-
TVOS_DEPLOYMENT_TARGET = 9.0;
660+
TVOS_DEPLOYMENT_TARGET = 10.0;
667661
VALID_ARCHS = "i386 x86_64 armv7 armv7s arm64 armv7k";
668-
WATCHOS_DEPLOYMENT_TARGET = 2.0;
662+
WATCHOS_DEPLOYMENT_TARGET = 7.0;
669663
};
670664
name = Release;
671665
};

Diff for: Source/SocketIO/Ack/SocketAckManager.swift

+10
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ public enum SocketAckStatus : String {
3131

3232
/// The ack timed out.
3333
case noAck = "NO ACK"
34+
35+
/// Tests whether a string is equal to a given SocketAckStatus
36+
public static func == (lhs: String, rhs: SocketAckStatus) -> Bool {
37+
return lhs == rhs.rawValue
38+
}
39+
40+
/// Tests whether a string is equal to a given SocketAckStatus
41+
public static func == (lhs: SocketAckStatus, rhs: String) -> Bool {
42+
return rhs == lhs
43+
}
3444
}
3545

3646
private struct SocketAck : Hashable {

0 commit comments

Comments
 (0)