Skip to content

Commit 176986d

Browse files
committed
Merge branch 'development'
* development: (31 commits) Add note about namespace methods Add note in changelog to checkout the migration guide Add more to the migration guide don't return optional from defaultSocket Add link to 12to13 and style Start working on a migration guide Fix socketio#855 refactor SocketIOClient.handlePacket bump version Do we really need to update carthage? Make sure to turn off logging in setup Don't use NSDictionary in definitions Fix tests Fix changelog update starscream versions nsp should be readonly now Add SocketManager for multiplexing namespaces Change sentPing/gotPong to ping/pong since those are already reserved Fix comment Add ability to track ping/pongs ...
2 parents 6905113 + f2ae32b commit 176986d

Some content is hidden

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

44 files changed

+1926
-2027
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ branches:
77
- master
88
- development
99
before_install:
10-
- brew update
10+
# - brew update
1111
# - brew outdated xctool || brew upgrade xctool
12-
- brew outdated carthage || brew upgrade carthage
12+
# - brew outdated carthage || brew upgrade carthage
1313
- carthage update --platform macosx
1414
script:
15-
- xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build test -quiet
16-
# - xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build-for-testing -quiet
17-
# - xctool -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac run-tests --parallelize
15+
- xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO build test -quiet
16+
# - xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO build-for-testing -quiet
17+
# - xctool -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO run-tests --parallelize
1818
- swift test

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# v13.0.0
2+
3+
Checkout out the migration guide in Usage Docs for a more detailed guide on how to migrate to this version.
4+
5+
What's new:
6+
---
7+
8+
- Adds a new `SocketManager` class that multiplexes multiple namespaces through a single engine.
9+
- Adds `.sentPing` and `.gotPong` client events for tracking ping/pongs.
10+
- watchOS support.
11+
12+
Important API changes
13+
---
14+
15+
- Many properties that were previously on `SocketIOClient` have been moved to the `SocketManager`.
16+
- `SocketIOClientOption.nsp` has been removed. Use `SocketManager.socket(forNamespace:)` to create/get a socket attached to a specific namespace.
17+
- Adds `.sentPing` and `.gotPong` client events for tracking ping/pongs.
18+
- Makes the framework a single target.
19+
- Updates Starscream to 3.0
20+

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "daltoniam/Starscream" ~> 2.0
1+
github "daltoniam/Starscream" ~> 3.0

Cartfile.resolved

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
github "daltoniam/Starscream" "2.1.1"
1+
github "daltoniam/common-crypto-spm" "1.1.0"
2+
github "daltoniam/zlib-spm" "1.1.0"
3+
github "daltoniam/Starscream" "3.0.2"

Package.resolved

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"repositoryURL": "https://github.com/daltoniam/Starscream",
2525
"state": {
2626
"branch": null,
27-
"revision": "21678c9426dde2a77152a0d5982cdb952baf0455",
28-
"version": "2.1.1"
27+
"revision": "44ce58956fae7db22fb0106cb4ce3dbef3d06d00",
28+
"version": "3.0.2"
2929
}
3030
}
3131
]

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let package = Package(
88
.library(name: "SocketIO", targets: ["SocketIO"])
99
],
1010
dependencies: [
11-
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMajor(from: "2.1.1")),
11+
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.0.0")),
1212
],
1313
targets: [
1414
.target(name: "SocketIO", dependencies: ["Starscream"]),

README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ Socket.IO-client for iOS/OS X.
77
```swift
88
import SocketIO
99

10-
let socket = SocketIOClient(socketURL: URL(string: "http://localhost:8080")!, config: [.log(true), .compress])
10+
let manager = SocketManager(socketURL: URL(string: "http://localhost:8080")!, config: [.log(true), .compress])
11+
let socket = manager.defaultSocket
1112

1213
socket.on(clientEvent: .connect) {data, ack in
1314
print("socket connected")
1415
}
1516

1617
socket.on("currentAmount") {data, ack in
17-
if let cur = data[0] as? Double {
18-
socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in
19-
socket.emit("update", ["amount": cur + 2.50])
20-
}
21-
22-
ack.with("Got your currentAmount", "dude")
18+
guard let cur = data[0] as? Double else { return }
19+
20+
socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in
21+
socket.emit("update", ["amount": cur + 2.50])
2322
}
23+
24+
ack.with("Got your currentAmount", "dude")
2425
}
2526

2627
socket.connect()
@@ -29,8 +30,10 @@ socket.connect()
2930
## Objective-C Example
3031
```objective-c
3132
@import SocketIO;
33+
3234
NSURL* url = [[NSURL alloc] initWithString:@"http://localhost:8080"];
33-
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{@"log": @YES, @"compress": @YES}];
35+
SocketManager* manager = [[SocketManager alloc] initWithSocketURL:url config:@{@"log": @YES, @"compress": @YES}];
36+
SocketIOClient* socket = manager.defaultSocket;
3437

3538
[socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
3639
NSLog(@"socket connected");
@@ -60,6 +63,9 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{
6063
## FAQS
6164
Checkout the [FAQs](https://nuclearace.github.io/Socket.IO-Client-Swift/faq.html) for commonly asked questions.
6265
66+
Checkout the [12to13](https://nuclearace.github.io/Socket.IO-Client-Swift/12to13.html) guide for migrating to v13.
67+
68+
6369
## Installation
6470
Requires Swift 4/Xcode 9.x
6571
@@ -80,7 +86,7 @@ let package = Package(
8086
.executable(name: "socket.io-test", targets: ["YourTargetName"])
8187
],
8288
dependencies: [
83-
.package(url: "https://github.com/socketio/socket.io-client-swift", .upToNextMajor(from: "12.1.0"))
89+
.package(url: "https://github.com/socketio/socket.io-client-swift", .upToNextMinor(from: "13.0.0"))
8490
],
8591
targets: [
8692
.target(name: "YourTargetName", dependencies: ["SocketIO"], path: "./Path/To/Your/Sources")
@@ -93,7 +99,7 @@ Then import `import SocketIO`.
9399
### Carthage
94100
Add this line to your `Cartfile`:
95101
```
96-
github "socketio/socket.io-client-swift" ~> 12.1.3 # Or latest version
102+
github "socketio/socket.io-client-swift" ~> 13.0.0 # Or latest version
97103
```
98104

99105
Run `carthage update --platform ios,macosx`.
@@ -107,7 +113,7 @@ Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
107113
use_frameworks!
108114

109115
target 'YourApp' do
110-
pod 'Socket.IO-Client-Swift', '~> 12.1.3' # Or latest version
116+
pod 'Socket.IO-Client-Swift', '~> 13.0.0' # Or latest version
111117
end
112118
```
113119

@@ -134,6 +140,7 @@ Objective-C:
134140
# [Docs](https://nuclearace.github.io/Socket.IO-Client-Swift/index.html)
135141

136142
- [Client](https://nuclearace.github.io/Socket.IO-Client-Swift/Classes/SocketIOClient.html)
143+
- [Manager](https://nuclearace.github.io/Socket.IO-Client-Swift/Classes/SocketManager.html)
137144
- [Engine](https://nuclearace.github.io/Socket.IO-Client-Swift/Classes/SocketEngine.html)
138145
- [Options](https://nuclearace.github.io/Socket.IO-Client-Swift/Enums/SocketIOClientOption.html)
139146

Socket.IO-Client-Swift.podspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "Socket.IO-Client-Swift"
33
s.module_name = "SocketIO"
4-
s.version = "12.1.3"
4+
s.version = "13.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.
@@ -14,15 +14,16 @@ Pod::Spec.new do |s|
1414
s.ios.deployment_target = '8.0'
1515
s.osx.deployment_target = '10.10'
1616
s.tvos.deployment_target = '9.0'
17+
s.watchos.deployment_target = '2.0'
1718
s.requires_arc = true
1819
s.source = {
1920
:git => "https://github.com/socketio/socket.io-client-swift.git",
20-
:tag => 'v12.1.3',
21+
:tag => 'v13.0.0',
2122
:submodules => true
2223
}
2324
s.pod_target_xcconfig = {
2425
'SWIFT_VERSION' => '4.0'
2526
}
2627
s.source_files = "Source/SocketIO/**/*.swift", "Source/SocketIO/*.swift"
27-
s.dependency "Starscream", "~> 2.1.1"
28+
s.dependency "Starscream", "~> 3.0.2"
2829
end

0 commit comments

Comments
 (0)