Compare commits
410
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99cc2448f7 | ||
|
|
99b673dfa5 | ||
|
|
b4bff5db90 | ||
|
|
354ed7e5e4 | ||
|
|
5ecc5bbae9 | ||
|
|
d069bbeefe | ||
|
|
eb806b62bf | ||
|
|
6dd51170bb | ||
|
|
76b941933e | ||
|
|
71a627c099 | ||
|
|
a21af1016e | ||
|
|
85585c42c0 | ||
|
|
175da8b515 | ||
|
|
ccc73e3790 | ||
|
|
786b11ad46 | ||
|
|
332a25f241 | ||
|
|
12b08a975f | ||
|
|
2058eba1fb | ||
|
|
d7846b31a2 | ||
|
|
3c81d0ee55 | ||
|
|
0898078cc8 | ||
|
|
69124a74e8 | ||
|
|
4325b6d139 | ||
|
|
66eca437b8 | ||
|
|
8837d4a0d8 | ||
|
|
61a7f2e936 | ||
|
|
45cc6b9728 | ||
|
|
173def3cea | ||
|
|
2b1cd74f6a | ||
|
|
e1c18a3ea8 | ||
|
|
eb9de532f1 | ||
|
|
a1ed825835 | ||
|
|
cc3ce5679e | ||
|
|
b686b17e0a | ||
|
|
c6d28246ea | ||
|
|
f4f071551f | ||
|
|
ec4378ca49 | ||
|
|
d031afdbc4 | ||
|
|
61d0a41103 | ||
|
|
07f2d08981 | ||
|
|
9609774b3a | ||
|
|
8d9a613835 | ||
|
|
678fb81ed5 | ||
|
|
af5ce97b75 | ||
|
|
2c78e36ebd | ||
|
|
162eb3d649 | ||
|
|
ef6b63c82f | ||
|
|
c015012783 | ||
|
|
6b80f75ec8 | ||
|
|
bdcdddf465 | ||
|
|
2a0e0f5e28 | ||
|
|
888b84aee2 | ||
|
|
8b1149255d | ||
|
|
2913751beb | ||
|
|
1c2af5a60f | ||
|
|
fde88c10c5 | ||
|
|
21290f5752 | ||
|
|
194642314e | ||
|
|
d7d8903fee | ||
|
|
ce4de49d50 | ||
|
|
b130231f4e | ||
|
|
7ce0d99526 | ||
|
|
c6a6d952e6 | ||
|
|
6cd8f79e8b | ||
|
|
9433f60557 | ||
|
|
6992ea5250 | ||
|
|
a06af14dd9 | ||
|
|
68376581a0 | ||
|
|
eb47dcadd4 | ||
|
|
36db2ff0eb | ||
|
|
046bb0e9ff | ||
|
|
0dc4dd4a93 | ||
|
|
cb74f6ca55 | ||
|
|
1a0f6bb6ce | ||
|
|
091797f9b7 | ||
|
|
5611c8ad24 | ||
|
|
ae54ea01d0 | ||
|
|
1db9232d71 | ||
|
|
5dcfe18748 | ||
|
|
558ea65aa1 | ||
|
|
0d44b10734 | ||
|
|
c1744e9e6f | ||
|
|
2fd9e4b993 | ||
|
|
44682659b6 | ||
|
|
148c302474 | ||
|
|
6037b85f4b | ||
|
|
bd7428485c | ||
|
|
3df38fcff5 | ||
|
|
7219906306 | ||
|
|
7e0917c2cd | ||
|
|
0df634a586 | ||
|
|
1a8285fcf0 | ||
|
|
fc4e1802f6 | ||
|
|
19a177485d | ||
|
|
00aaea935c | ||
|
|
6a3d82c60a | ||
|
|
4c98c24047 | ||
|
|
a17a66af00 | ||
|
|
9433050588 | ||
|
|
49b9a07a95 | ||
|
|
f407beab99 | ||
|
|
fa81fc222f | ||
|
|
649989fd83 | ||
|
|
f7ef126d97 | ||
|
|
e4f63e8f15 | ||
|
|
3cfd12b0bc | ||
|
|
94b01420af | ||
|
|
ec86a19fc6 | ||
|
|
e0cbe59a10 | ||
|
|
8f94c038d8 | ||
|
|
a4b334b6f2 | ||
|
|
9708019adc | ||
|
|
5a6a4f02d9 | ||
|
|
75057023cb | ||
|
|
d839a35340 | ||
|
|
d5a478f64a | ||
|
|
e5f3fb13ae | ||
|
|
0d8890defd | ||
|
|
016e12720d | ||
|
|
d25a926226 | ||
|
|
09fc43349f | ||
|
|
b3e305fd14 | ||
|
|
d763fad449 | ||
|
|
e877bb26c3 | ||
|
|
28fad62ccd | ||
|
|
f9d8595a25 | ||
|
|
3bf28cd427 | ||
|
|
c3032579c0 | ||
|
|
867db19bc5 | ||
|
|
cfa6a217be | ||
|
|
520ff72395 | ||
|
|
25df8b66fc | ||
|
|
d632135289 | ||
|
|
a3d443268a | ||
|
|
d03e319e35 | ||
|
|
165ec25713 | ||
|
|
35c93ee6f5 | ||
|
|
cc90426d94 | ||
|
|
6db5348daa | ||
|
|
9bf073156f | ||
|
|
8f50375cf2 | ||
|
|
451f4c1b69 | ||
|
|
95aa544275 | ||
|
|
eab73c81a7 | ||
|
|
cfc01ac9fc | ||
|
|
64d2527190 | ||
|
|
b48f1e9af5 | ||
|
|
6cfea5aca3 | ||
|
|
d06c1e5f5b | ||
|
|
2cc47b0117 | ||
|
|
884cc6f8f1 | ||
|
|
2629449436 | ||
|
|
0a7e1f4185 | ||
|
|
5fdff65281 | ||
|
|
f7ccf338ad | ||
|
|
feb476c76b | ||
|
|
b258a93750 | ||
|
|
d07441e7fa | ||
|
|
6564d1a0c5 | ||
|
|
41af615428 | ||
|
|
4ea1bb9c43 | ||
|
|
c3cabe43bf | ||
|
|
6ff403fad1 | ||
|
|
b73afe0da9 | ||
|
|
be43b0ab3c | ||
|
|
24f3106fe7 | ||
|
|
1b6144a78c | ||
|
|
948ea5fa00 | ||
|
|
d21a65e117 | ||
|
|
4564aebec1 | ||
|
|
840892288b | ||
|
|
47bcfb1299 | ||
|
|
d24e8f83c6 | ||
|
|
731aaf4203 | ||
|
|
746be11f3b | ||
|
|
5634b33d19 | ||
|
|
3a09e7d548 | ||
|
|
31aed9e793 | ||
|
|
4e558833a3 | ||
|
|
07c3678ea9 | ||
|
|
ef02247a0c | ||
|
|
d811b194eb | ||
|
|
9b10cab925 | ||
|
|
1e29b2047d | ||
|
|
8df1a12412 | ||
|
|
d853d8594a | ||
|
|
c3a8c411a5 | ||
|
|
d388e1cf03 | ||
|
|
ea93e69d5c | ||
|
|
4ec634ccfd | ||
|
|
fa7fcc8c3b | ||
|
|
8eca6249c0 | ||
|
|
3d9b2b2c1c | ||
|
|
658d5f5b71 | ||
|
|
9224e2b3e6 | ||
|
|
c395fa3f0f | ||
|
|
f74eb8c88a | ||
|
|
1025c80ef5 | ||
|
|
313032aa41 | ||
|
|
a611aee899 | ||
|
|
0dff23d42b | ||
|
|
0a27b2ea10 | ||
|
|
fa60b9a80a | ||
|
|
f0ac68e369 | ||
|
|
11bc8e5df2 | ||
|
|
3df5d6d0b4 | ||
|
|
ef2228cf29 | ||
|
|
a9b5259a08 | ||
|
|
3525caedd1 | ||
|
|
943e94ed0e | ||
|
|
96ce620f69 | ||
|
|
1458a482d0 | ||
|
|
fd548121c2 | ||
|
|
05943767e5 | ||
|
|
2fa0a43e4c | ||
|
|
fa34cd9be5 | ||
|
|
b6a8984ce0 | ||
|
|
176986d22a | ||
|
|
f2ae32b01d | ||
|
|
c141f7c105 | ||
|
|
5c9dc2cee8 | ||
|
|
3595662729 | ||
|
|
c98df21747 | ||
|
|
f0a792bd51 | ||
|
|
fa5e815912 | ||
|
|
6905113b49 | ||
|
|
45af5d96d9 | ||
|
|
ff0f1c8c77 | ||
|
|
d251b4de87 | ||
|
|
5cfc97386a | ||
|
|
c9e6d3ec33 | ||
|
|
5db5260ae8 | ||
|
|
6e3d97617f | ||
|
|
cf597ae09d | ||
|
|
846e7cb0aa | ||
|
|
a255d1131d | ||
|
|
16e85a297c | ||
|
|
535f1700bf | ||
|
|
5a85c97f3d | ||
|
|
5b52edd880 | ||
|
|
1ed87e571d | ||
|
|
bb1618faaf | ||
|
|
c03fc96f04 | ||
|
|
7b04309990 | ||
|
|
22fa1d4894 | ||
|
|
f9360fc94f | ||
|
|
953bc09bf3 | ||
|
|
c3c2c24254 | ||
|
|
51a1be19c8 | ||
|
|
7b9997b111 | ||
|
|
98a8e4f7f8 | ||
|
|
f85877fb72 | ||
|
|
18b1c65c7c | ||
|
|
0d6c7ece04 | ||
|
|
07dc3e4040 | ||
|
|
099c379272 | ||
|
|
f6d62301e7 | ||
|
|
c6bdf43d8d | ||
|
|
45955aec4a | ||
|
|
2865c72748 | ||
|
|
d4624e08bf | ||
|
|
102251b0bb | ||
|
|
40c98d5027 | ||
|
|
c8a127a8ed | ||
|
|
5c0bbde77b | ||
|
|
cd2454373a | ||
|
|
84218d55c3 | ||
|
|
665cfef8d3 | ||
|
|
43907a4001 | ||
|
|
66d052cee2 | ||
|
|
a2b1a999e5 | ||
|
|
5e69272ebc | ||
|
|
185d9708cd | ||
|
|
6138c535c9 | ||
|
|
392e479c59 | ||
|
|
15198fd9c2 | ||
|
|
3ee3f4f297 | ||
|
|
fb02d154e1 | ||
|
|
883b0f3ba4 | ||
|
|
6bff01a3b5 | ||
|
|
42d96d96fd | ||
|
|
819735efbf | ||
|
|
28cc8eef19 | ||
|
|
321bb186df | ||
|
|
91eea96308 | ||
|
|
486a89d407 | ||
|
|
5607280836 | ||
|
|
d878f56839 | ||
|
|
ca4261d8ca | ||
|
|
6eafce0082 | ||
|
|
752407fb67 | ||
|
|
4d30b3c951 | ||
|
|
1421da2aab | ||
|
|
4dcfcc2a84 | ||
|
|
8f50c5a3de | ||
|
|
8364815deb | ||
|
|
fc2852d1c1 | ||
|
|
9be3184f2a | ||
|
|
62d59d7762 | ||
|
|
bf2beb7431 | ||
|
|
ce8f1523cf | ||
|
|
32e0fe312b | ||
|
|
ad2fb175b3 | ||
|
|
04ba1aa1c5 | ||
|
|
dc4c25bff5 | ||
|
|
dc3b1ea8c7 | ||
|
|
2ac2f928c4 | ||
|
|
358e44a436 | ||
|
|
2f92a69bb0 | ||
|
|
6ca72c5751 | ||
|
|
4b48bdd3e5 | ||
|
|
cd3eb37ac8 | ||
|
|
e9296fd65a | ||
|
|
dda4a31149 | ||
|
|
02d82adf07 | ||
|
|
654d71abed | ||
|
|
5bcb075aa5 | ||
|
|
21ea0aff42 | ||
|
|
f6fa5b79ea | ||
|
|
d8104f4bf8 | ||
|
|
0516d3555a | ||
|
|
df8f87cc21 | ||
|
|
3019fd7ea3 | ||
|
|
5470fb6926 | ||
|
|
3eb7edc37c | ||
|
|
eef5fd987d | ||
|
|
757bfdc867 | ||
|
|
4237ed0d92 | ||
|
|
4929c8488c | ||
|
|
04e90fc905 | ||
|
|
64b56c593e | ||
|
|
ef84747de2 | ||
|
|
56fe22cc58 | ||
|
|
038e1b0881 | ||
|
|
ef278b0645 | ||
|
|
3c507d135f | ||
|
|
86155d5714 | ||
|
|
a1399d8c5c | ||
|
|
323327b0f2 | ||
|
|
710dd3cd7f | ||
|
|
4f83c466f0 | ||
|
|
955382eb8f | ||
|
|
4968e752e6 | ||
|
|
c8ff5bac96 | ||
|
|
afbf2cfc40 | ||
|
|
079c8e4e4c | ||
|
|
8c5f53d868 | ||
|
|
e6a2605c53 | ||
|
|
c1d8158ba5 | ||
|
|
6c510ebdb5 | ||
|
|
db81499eb8 | ||
|
|
b5d459be0d | ||
|
|
60b7beefa5 | ||
|
|
0d14294d79 | ||
|
|
818f82aaa5 | ||
|
|
54c2b3bd35 | ||
|
|
8be2df0f4b | ||
|
|
f34750a5ff | ||
|
|
5621f0dbe1 | ||
|
|
18efea4bad | ||
|
|
7a16d157f7 | ||
|
|
6d7ca472a3 | ||
|
|
0e5ffce862 | ||
|
|
ec5a8536be | ||
|
|
1ed131d925 | ||
|
|
74c45d5881 | ||
|
|
619db00c54 | ||
|
|
6d21dfdade | ||
|
|
38a1187cb7 | ||
|
|
2b6b001c0c | ||
|
|
f799cb3a34 | ||
|
|
00ea70e3bc | ||
|
|
684b9473d7 | ||
|
|
319fca0227 | ||
|
|
245c5a1392 | ||
|
|
92792ba71e | ||
|
|
817f36e80b | ||
|
|
3ba3354e9a | ||
|
|
98ac2a8035 | ||
|
|
72cd9d663e | ||
|
|
9c4a3ba8c4 | ||
|
|
b3ea49f7fd | ||
|
|
967c5e49c2 | ||
|
|
781a9e32ca | ||
|
|
f00af67283 | ||
|
|
b62f69a0ca | ||
|
|
407b5c644f | ||
|
|
89b866a611 | ||
|
|
0013e7fdb6 | ||
|
|
49961eb6cf | ||
|
|
54c54a23b7 | ||
|
|
beaa4b695c | ||
|
|
141b0ce6bc | ||
|
|
206e1eed4f | ||
|
|
1a42580826 | ||
|
|
6b4dfd578f | ||
|
|
630ef27436 | ||
|
|
6a8a5dc24a | ||
|
|
8f22bdef46 | ||
|
|
a2ea2df83a | ||
|
|
d37c7123d9 | ||
|
|
7ff10d141f | ||
|
|
839987727e | ||
|
|
c6dd1fb19b | ||
|
|
d1cbbc0213 | ||
|
|
d09c2f046b | ||
|
|
38dea9bb3e | ||
|
|
b86e78797e | ||
|
|
777f6e2406 | ||
|
|
33d7230a5f |
No files matched your search
@@ -0,0 +1,19 @@
|
||||
name: Swift
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master", "development" ]
|
||||
pull_request:
|
||||
branches: [ "master", "development" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
run: swift build -v
|
||||
- name: Run tests
|
||||
run: swift test -v
|
||||
@@ -50,3 +50,5 @@ Socket.IO-Test-Server/node_modules/*
|
||||
.idea/
|
||||
docs/docsets/
|
||||
docs/undocumented.json
|
||||
|
||||
.swiftpm
|
||||
@@ -1 +0,0 @@
|
||||
3.1
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
language: objective-c
|
||||
xcode_project: Socket.IO-Client-Swift.xcodeproj # path to your xcodeproj folder
|
||||
xcode_scheme: SocketIO-iOS
|
||||
osx_image: xcode8.3
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- development
|
||||
before_install:
|
||||
- brew update
|
||||
- brew outdated xctool || brew upgrade xctool
|
||||
script:
|
||||
- xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build-for-testing -quiet
|
||||
- xctool -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac run-tests --parallelize
|
||||
#script: xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build test
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
# v16.1.0
|
||||
|
||||
- Remove support for iOS 11.
|
||||
- Update to Starscream 4.0.6
|
||||
|
||||
# v16.0.0
|
||||
|
||||
- Removed Objective-C support. It's time for you to embrace Swift.
|
||||
- Socket.io 3 support.
|
||||
|
||||
# v15.3.0
|
||||
|
||||
- Add `==` operators for `SocketAckStatus` and `String`
|
||||
|
||||
# v15.2.0
|
||||
|
||||
- Small fixes.
|
||||
|
||||
# v15.1.0
|
||||
|
||||
- Add ability to enable websockets SOCKS proxy.
|
||||
- Fix emit completion callback not firing on websockets [#1178](https://github.com/socketio/socket.io-client-swift/issues/1178)
|
||||
|
||||
# v15.0.0
|
||||
|
||||
- Swift 5
|
||||
|
||||
# v14.0.0
|
||||
|
||||
- Minimum version of the client is now Swift 4.2.
|
||||
- Add exponential backoff for reconnects, with `reconnectWaitMax` and `randomizationFactor` options [#1149](https://github.com/socketio/socket.io-client-swift/pull/1149)
|
||||
- `statusChange` event's data format adds a second value, the raw value of the status. This is for use in Objective-C. [#1147](https://github.com/socketio/socket.io-client-swift/issues/1147)
|
||||
|
||||
# v13.4.0
|
||||
|
||||
- Add emits with write completion handlers. [#1096](https://github.com/socketio/socket.io-client-swift/issues/1096)
|
||||
- Add ability to listen for when a websocket upgrade happens
|
||||
|
||||
# v13.3.1
|
||||
|
||||
- Fixes various bugs. [#857](https://github.com/socketio/socket.io-client-swift/issues/857), [#1078](https://github.com/socketio/socket.io-client-swift/issues/1078)
|
||||
|
||||
# v13.3.0
|
||||
|
||||
- Copy cookies from polling to WebSockets ([#1057](https://github.com/socketio/socket.io-client-swift/issues/1057), [#1058](https://github.com/socketio/socket.io-client-swift/issues/1058))
|
||||
|
||||
# v13.2.1
|
||||
|
||||
- Fix packets getting lost when WebSocket upgrade fails. [#1033](https://github.com/socketio/socket.io-client-swift/issues/1033)
|
||||
- Fix bad unit tests. [#794](https://github.com/socketio/socket.io-client-swift/issues/794)
|
||||
|
||||
# v13.2.0
|
||||
|
||||
- Add ability to bypass Data inspection in emits. [#992]((https://github.com/socketio/socket.io-client-swift/issues/992))
|
||||
- Allow `SocketEngine` to be subclassed
|
||||
|
||||
# v13.1.3
|
||||
|
||||
- Fix setting reconnectAttempts [#989]((https://github.com/socketio/socket.io-client-swift/issues/989))
|
||||
|
||||
|
||||
# v13.1.2
|
||||
|
||||
- Fix [#950](https://github.com/socketio/socket.io-client-swift/issues/950)
|
||||
- Conforming to `SocketEngineWebsocket` no longer requires conforming to `WebsocketDelegate`
|
||||
|
||||
|
||||
# v13.1.1
|
||||
|
||||
- Fix [#923](https://github.com/socketio/socket.io-client-swift/issues/923)
|
||||
- Fix [#894](https://github.com/socketio/socket.io-client-swift/issues/894)
|
||||
|
||||
# v13.1.0
|
||||
|
||||
- Allow setting `SocketEngineSpec.extraHeaders` after init.
|
||||
- Deprecate `SocketEngineSpec.websocket` in favor of just using the `SocketEngineSpec.polling` property.
|
||||
- Enable bitcode for most platforms.
|
||||
- Fix [#882](https://github.com/socketio/socket.io-client-swift/issues/882). This adds a new method
|
||||
`SocketManger.removeSocket(_:)` that should be called if when you no longer wish to use a socket again.
|
||||
This will cause the engine to no longer keep a strong reference to the socket and no longer track it.
|
||||
|
||||
# v13.0.1
|
||||
|
||||
- Fix not setting handleQueue on `SocketManager`
|
||||
|
||||
# v13.0.0
|
||||
|
||||
Checkout out the migration guide in Usage Docs for a more detailed guide on how to migrate to this version.
|
||||
|
||||
What's new:
|
||||
---
|
||||
|
||||
- Adds a new `SocketManager` class that multiplexes multiple namespaces through a single engine.
|
||||
- Adds `.sentPing` and `.gotPong` client events for tracking ping/pongs.
|
||||
- watchOS support.
|
||||
|
||||
Important API changes
|
||||
---
|
||||
|
||||
- Many properties that were previously on `SocketIOClient` have been moved to the `SocketManager`.
|
||||
- `SocketIOClientOption.nsp` has been removed. Use `SocketManager.socket(forNamespace:)` to create/get a socket attached to a specific namespace.
|
||||
- Adds `.sentPing` and `.gotPong` client events for tracking ping/pongs.
|
||||
- Makes the framework a single target.
|
||||
- Updates Starscream to 3.0
|
||||
@@ -0,0 +1 @@
|
||||
github "daltoniam/Starscream" "4.0.6"
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "Starscream",
|
||||
"repositoryURL": "https://github.com/daltoniam/Starscream",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "c6bfd1af48efcc9a9ad203665db12375ba6b145a",
|
||||
"version": "4.0.8"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
+13
-1
@@ -1,5 +1,17 @@
|
||||
// swift-tools-version:5.4
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "SocketIO"
|
||||
name: "SocketIO",
|
||||
products: [
|
||||
.library(name: "SocketIO", targets: ["SocketIO"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMajor(from: "4.0.8")),
|
||||
],
|
||||
targets: [
|
||||
.target(name: "SocketIO", dependencies: ["Starscream"]),
|
||||
.testTarget(name: "TestSocketIO", dependencies: ["SocketIO"]),
|
||||
]
|
||||
)
|
||||
@@ -7,82 +7,64 @@ Socket.IO-client for iOS/OS X.
|
||||
```swift
|
||||
import SocketIO
|
||||
|
||||
let socket = SocketIOClient(socketURL: URL(string: "http://localhost:8080")!, config: [.log(true), .forcePolling(true)])
|
||||
let manager = SocketManager(socketURL: URL(string: "http://localhost:8080")!, config: [.log(true), .compress])
|
||||
let socket = manager.defaultSocket
|
||||
|
||||
socket.on(clientEvent: .connect) {data, ack in
|
||||
print("socket connected")
|
||||
}
|
||||
|
||||
socket.on("currentAmount") {data, ack in
|
||||
if let cur = data[0] as? Double {
|
||||
socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in
|
||||
socket.emit("update", ["amount": cur + 2.50])
|
||||
guard let cur = data[0] as? Double else { return }
|
||||
|
||||
socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in
|
||||
if data.first as? String ?? "passed" == SocketAckStatus.noAck {
|
||||
// Handle ack timeout
|
||||
}
|
||||
|
||||
ack.with("Got your currentAmount", "dude")
|
||||
socket.emit("update", ["amount": cur + 2.50])
|
||||
}
|
||||
|
||||
ack.with("Got your currentAmount", "dude")
|
||||
}
|
||||
|
||||
socket.connect()
|
||||
```
|
||||
|
||||
## Objective-C Example
|
||||
```objective-c
|
||||
@import SocketIO;
|
||||
NSURL* url = [[NSURL alloc] initWithString:@"http://localhost:8080"];
|
||||
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{@"log": @YES, @"forcePolling": @YES}];
|
||||
|
||||
[socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
|
||||
NSLog(@"socket connected");
|
||||
}];
|
||||
|
||||
[socket on:@"currentAmount" callback:^(NSArray* data, SocketAckEmitter* ack) {
|
||||
double cur = [[data objectAtIndex:0] floatValue];
|
||||
|
||||
[[socket emitWithAck:@"canUpdate" with:@[@(cur)]] timingOutAfter:0 callback:^(NSArray* data) {
|
||||
[socket emit:@"update" withItems:@[@{@"amount": @(cur + 2.50)}]];
|
||||
}];
|
||||
|
||||
[ack with:@[@"Got your currentAmount, ", @"dude"]];
|
||||
}];
|
||||
|
||||
[socket connect];
|
||||
|
||||
```
|
||||
|
||||
## Features
|
||||
- Supports socket.io 2.0+ (For socket.io 1.0 use v9.x)
|
||||
- Supports binary
|
||||
- Supports Socket.IO server 2.0+/3.0+/4.0+ (see the [compatibility table](https://nuclearace.github.io/Socket.IO-Client-Swift/Compatibility.html))
|
||||
- Supports Binary
|
||||
- Supports Polling and WebSockets
|
||||
- Supports TLS/SSL
|
||||
- Can be used from Objective-C
|
||||
|
||||
## FAQS
|
||||
Checkout the [FAQs](https://nuclearace.github.io/Socket.IO-Client-Swift/faq.html) for commonly asked questions.
|
||||
|
||||
|
||||
Checkout the [12to13](https://nuclearace.github.io/Socket.IO-Client-Swift/12to13.html) guide for migrating to v13+ from v12 below.
|
||||
|
||||
Checkout the [15to16](https://nuclearace.github.io/Socket.IO-Client-Swift/15to16.html) guide for migrating to v16+ from v15.
|
||||
|
||||
## Installation
|
||||
Requires Swift 3/Xcode 8.x
|
||||
|
||||
If you need swift 2.3 use the swift2.3 tag (Pre-Swift 3 support is no longer maintained)
|
||||
|
||||
If you need swift 2.2 use 7.x (Pre-Swift 3 support is no longer maintained)
|
||||
|
||||
If you need Swift 2.1 use v5.5.0 (Pre-Swift 2.2 support is no longer maintained)
|
||||
|
||||
If you need Swift 1.2 use v2.4.5 (Pre-Swift 2 support is no longer maintained)
|
||||
|
||||
If you need Swift 1.1 use v1.5.2. (Pre-Swift 1.2 support is no longer maintained)
|
||||
|
||||
### Manually (iOS 7+)
|
||||
1. Copy the Source folder into your Xcode project. (Make sure you add the files to your target(s))
|
||||
2. If you plan on using this from Objective-C, read [this](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) on exposing Swift code to Objective-C.
|
||||
Requires Swift 4/5 and Xcode 10.x
|
||||
|
||||
### Swift Package Manager
|
||||
Add the project as a dependency to your Package.swift:
|
||||
```swift
|
||||
// swift-tools-version:4.2
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "YourSocketIOProject",
|
||||
name: "socket.io-test",
|
||||
products: [
|
||||
.executable(name: "socket.io-test", targets: ["YourTargetName"])
|
||||
],
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/socketio/socket.io-client-swift", majorVersion: 9)
|
||||
.package(url: "https://github.com/socketio/socket.io-client-swift", .upToNextMinor(from: "15.0.0"))
|
||||
],
|
||||
targets: [
|
||||
.target(name: "YourTargetName", dependencies: ["SocketIO"], path: "./Path/To/Your/Sources")
|
||||
]
|
||||
)
|
||||
```
|
||||
@@ -92,11 +74,13 @@ Then import `import SocketIO`.
|
||||
### Carthage
|
||||
Add this line to your `Cartfile`:
|
||||
```
|
||||
github "socketio/socket.io-client-swift" ~> 10.0.0 # Or latest version
|
||||
github "socketio/socket.io-client-swift" ~> 15.2.0
|
||||
```
|
||||
|
||||
Run `carthage update --platform ios,macosx`.
|
||||
|
||||
Add the `Starscream` and `SocketIO` frameworks to your projects and follow the usual Carthage process.
|
||||
|
||||
### CocoaPods 1.0.0 or later
|
||||
Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
|
||||
|
||||
@@ -104,7 +88,7 @@ Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
|
||||
use_frameworks!
|
||||
|
||||
target 'YourApp' do
|
||||
pod 'Socket.IO-Client-Swift', '~> 10.0.0' # Or latest version
|
||||
pod 'Socket.IO-Client-Swift', '~> 15.2.0'
|
||||
end
|
||||
```
|
||||
|
||||
@@ -127,20 +111,11 @@ Objective-C:
|
||||
@import SocketIO;
|
||||
```
|
||||
|
||||
### CocoaSeeds
|
||||
|
||||
Add this line to your `Seedfile`:
|
||||
|
||||
```
|
||||
github "socketio/socket.io-client-swift", "v10.0.0", :files => "Source/*.swift" # Or latest version
|
||||
```
|
||||
|
||||
Run `seed install`.
|
||||
|
||||
|
||||
# [Docs](https://nuclearace.github.io/Socket.IO-Client-Swift/index.html)
|
||||
|
||||
- [Client](https://nuclearace.github.io/Socket.IO-Client-Swift/Classes/SocketIOClient.html)
|
||||
- [Manager](https://nuclearace.github.io/Socket.IO-Client-Swift/Classes/SocketManager.html)
|
||||
- [Engine](https://nuclearace.github.io/Socket.IO-Client-Swift/Classes/SocketEngine.html)
|
||||
- [Options](https://nuclearace.github.io/Socket.IO-Client-Swift/Enums/SocketIOClientOption.html)
|
||||
|
||||
|
||||
@@ -1,22 +1,31 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Socket.IO-Client-Swift"
|
||||
s.module_name = "SocketIO"
|
||||
s.version = "10.0.0"
|
||||
s.version = "16.1.0"
|
||||
s.summary = "Socket.IO-client for iOS and OS X"
|
||||
s.description = <<-DESC
|
||||
Socket.IO-client for iOS and OS X.
|
||||
Supports ws/wss/polling connections and binary.
|
||||
For socket.io 2.0+ and Swift.
|
||||
For socket.io 3.0+ and Swift.
|
||||
DESC
|
||||
s.homepage = "https://github.com/socketio/socket.io-client-swift"
|
||||
s.license = { :type => 'MIT' }
|
||||
s.author = { "Erik" => "nuclear.ace@gmail.com" }
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.osx.deployment_target = '10.10'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v10.0.0' }
|
||||
s.source_files = "Source/**/*.swift"
|
||||
s.ios.deployment_target = '12.0'
|
||||
s.osx.deployment_target = '10.13'
|
||||
s.tvos.deployment_target = '12.0'
|
||||
s.watchos.deployment_target = '5.0'
|
||||
s.requires_arc = true
|
||||
s.pod_target_xcconfig = {'SWIFT_VERSION' => '3.1'}
|
||||
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files
|
||||
s.source = {
|
||||
:git => "https://github.com/socketio/socket.io-client-swift.git",
|
||||
:tag => 'v16.1.0',
|
||||
:submodules => true
|
||||
}
|
||||
|
||||
s.swift_version = "5"
|
||||
s.pod_target_xcconfig = {
|
||||
'SWIFT_VERSION' => '5.4'
|
||||
}
|
||||
s.source_files = "Source/SocketIO/**/*.swift", "Source/SocketIO/*.swift"
|
||||
s.dependency "Starscream", "~> 4.0.6"
|
||||
end
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-iOS"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2231B51F16C00EEBB58"
|
||||
BuildableName = "SocketIO-iOSTests.xctest"
|
||||
BlueprintName = "SocketIO-iOSTests"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
codeCoverageEnabled = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2231B51F16C00EEBB58"
|
||||
BuildableName = "SocketIO-iOSTests.xctest"
|
||||
BlueprintName = "SocketIO-iOSTests"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-iOS"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-iOS"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2181B51F16C00EEBB58"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-iOS"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,113 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "576349FA1BD9B46A00E19CD7"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-tvOS"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "57634A181BD9B46D00E19CD7"
|
||||
BuildableName = "SocketIO-tvOSTests.xctest"
|
||||
BlueprintName = "SocketIO-tvOSTests"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "57634A181BD9B46D00E19CD7"
|
||||
BuildableName = "SocketIO-tvOSTests.xctest"
|
||||
BlueprintName = "SocketIO-tvOSTests"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "576349FA1BD9B46A00E19CD7"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-tvOS"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "576349FA1BD9B46A00E19CD7"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-tvOS"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "576349FA1BD9B46A00E19CD7"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-tvOS"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -16,7 +16,7 @@
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-Mac"
|
||||
BlueprintName = "SocketIO"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
@@ -29,8 +29,8 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2411B51F18A00EEBB58"
|
||||
BuildableName = "SocketIO-MacTests.xctest"
|
||||
BlueprintName = "SocketIO-MacTests"
|
||||
BuildableName = "SocketIO-Tests.xctest"
|
||||
BlueprintName = "SocketIO-Tests"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
@@ -47,8 +47,8 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2411B51F18A00EEBB58"
|
||||
BuildableName = "SocketIO-MacTests.xctest"
|
||||
BlueprintName = "SocketIO-MacTests"
|
||||
BuildableName = "SocketIO-Tests.xctest"
|
||||
BlueprintName = "SocketIO-Tests"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
@@ -58,7 +58,7 @@
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-Mac"
|
||||
BlueprintName = "SocketIO"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
@@ -80,7 +80,7 @@
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-Mac"
|
||||
BlueprintName = "SocketIO"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
@@ -98,7 +98,7 @@
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "572EF2371B51F18A00EEBB58"
|
||||
BuildableName = "SocketIO.framework"
|
||||
BlueprintName = "SocketIO-Mac"
|
||||
BlueprintName = "SocketIO"
|
||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,166 +0,0 @@
|
||||
//
|
||||
// SocketBasicPacketTest.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/7/15.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SocketIO
|
||||
|
||||
class SocketBasicPacketTest: XCTestCase {
|
||||
let data = "test".data(using: String.Encoding.utf8)!
|
||||
let data2 = "test2".data(using: String.Encoding.utf8)!
|
||||
|
||||
func testEmpyEmit() {
|
||||
let expectedSendString = "2[\"test\"]"
|
||||
let sendData = ["test"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testNullEmit() {
|
||||
let expectedSendString = "2[\"test\",null]"
|
||||
let sendData: [Any] = ["test", NSNull()]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testStringEmit() {
|
||||
let expectedSendString = "2[\"test\",\"foo bar\"]"
|
||||
let sendData = ["test", "foo bar"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testStringEmitWithQuotes() {
|
||||
let expectedSendString = "2[\"test\",\"\\\"he\\\"llo world\\\"\"]"
|
||||
let sendData = ["test", "\"he\"llo world\""]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testJSONEmit() {
|
||||
let expectedSendString = "2[\"test\",{\"null\":null,\"hello\":1,\"test\":\"hello\",\"foobar\":true}]"
|
||||
let sendData: [Any] = ["test", ["foobar": true, "hello": 1, "test": "hello", "null": NSNull()]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testArrayEmit() {
|
||||
let expectedSendString = "2[\"test\",[\"hello\",1,{\"test\":\"test\"}]]"
|
||||
let sendData: [Any] = ["test", ["hello", 1, ["test": "test"]]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testBinaryEmit() {
|
||||
let expectedSendString = "51-[\"test\",{\"_placeholder\":true,\"num\":0}]"
|
||||
let sendData: [Any] = ["test", data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
}
|
||||
|
||||
func testMultipleBinaryEmit() {
|
||||
let expectedSendString = "52-[\"test\",{\"data2\":{\"_placeholder\":true,\"num\":0},\"data1\":{\"_placeholder\":true,\"num\":1}}]"
|
||||
let sendData: [Any] = ["test", ["data1": data, "data2": data2] as NSDictionary]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data2, data])
|
||||
}
|
||||
|
||||
func testEmitWithAck() {
|
||||
let expectedSendString = "20[\"test\"]"
|
||||
let sendData = ["test"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString,
|
||||
|
||||
expectedSendString)
|
||||
}
|
||||
|
||||
func testEmitDataWithAck() {
|
||||
let expectedSendString = "51-0[\"test\",{\"_placeholder\":true,\"num\":0}]"
|
||||
let sendData: [Any] = ["test", data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
}
|
||||
|
||||
// Acks
|
||||
func testEmptyAck() {
|
||||
let expectedSendString = "30[]"
|
||||
let packet = SocketPacket.packetFromEmit([], id: 0, nsp: "/", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testNullAck() {
|
||||
let expectedSendString = "30[null]"
|
||||
let sendData = [NSNull()]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testStringAck() {
|
||||
let expectedSendString = "30[\"test\"]"
|
||||
let sendData = ["test"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testJSONAck() {
|
||||
let expectedSendString = "30[{\"null\":null,\"hello\":1,\"test\":\"hello\",\"foobar\":true}]"
|
||||
let sendData = [["foobar": true, "hello": 1, "test": "hello", "null": NSNull()]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testBinaryAck() {
|
||||
let expectedSendString = "61-0[{\"_placeholder\":true,\"num\":0}]"
|
||||
let sendData = [data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
}
|
||||
|
||||
func testMultipleBinaryAck() {
|
||||
let expectedSendString = "62-0[{\"data2\":{\"_placeholder\":true,\"num\":0},\"data1\":{\"_placeholder\":true,\"num\":1}}]"
|
||||
let sendData = [["data1": data, "data2": data2]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data2, data])
|
||||
}
|
||||
|
||||
func testBinaryStringPlaceholderInMessage() {
|
||||
let engineString = "52-[\"test\",\"~~0\",{\"num\":0,\"_placeholder\":true},{\"_placeholder\":true,\"num\":1}]"
|
||||
let socket = SocketIOClient(socketURL: URL(string: "http://localhost/")!)
|
||||
socket.setTestable()
|
||||
|
||||
if case let .right(packet) = socket.parseString(engineString) {
|
||||
var packet = packet
|
||||
XCTAssertEqual(packet.event, "test")
|
||||
_ = packet.addData(data)
|
||||
_ = packet.addData(data2)
|
||||
XCTAssertEqual(packet.args[0] as? String, "~~0")
|
||||
} else {
|
||||
XCTFail()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
//
|
||||
// SocketEngineTest.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/15/15.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SocketIO
|
||||
|
||||
class SocketEngineTest: XCTestCase {
|
||||
var client: SocketIOClient!
|
||||
var engine: SocketEngine!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
client = SocketIOClient(socketURL: URL(string: "http://localhost")!)
|
||||
engine = SocketEngine(client: client, url: URL(string: "http://localhost")!, options: nil)
|
||||
|
||||
client.setTestable()
|
||||
}
|
||||
|
||||
func testBasicPollingMessage() {
|
||||
let expect = expectation(description: "Basic polling test")
|
||||
client.on("blankTest") {data, ack in
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
engine.parsePollingMessage("15:42[\"blankTest\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testTwoPacketsInOnePollTest() {
|
||||
let finalExpectation = expectation(description: "Final packet in poll test")
|
||||
var gotBlank = false
|
||||
|
||||
client.on("blankTest") {data, ack in
|
||||
gotBlank = true
|
||||
}
|
||||
|
||||
client.on("stringTest") {data, ack in
|
||||
if let str = data[0] as? String, gotBlank {
|
||||
if str == "hello" {
|
||||
finalExpectation.fulfill()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
engine.parsePollingMessage("15:42[\"blankTest\"]24:42[\"stringTest\",\"hello\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testEngineDoesErrorOnUnknownTransport() {
|
||||
let finalExpectation = expectation(description: "Unknown Transport")
|
||||
|
||||
client.on("error") {data, ack in
|
||||
if let error = data[0] as? String, error == "Unknown transport" {
|
||||
finalExpectation.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
engine.parseEngineMessage("{\"code\": 0, \"message\": \"Unknown transport\"}")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testEngineDoesErrorOnUnknownMessage() {
|
||||
let finalExpectation = expectation(description: "Engine Errors")
|
||||
|
||||
client.on("error") {data, ack in
|
||||
finalExpectation.fulfill()
|
||||
}
|
||||
|
||||
engine.parseEngineMessage("afafafda")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testEngineDecodesUTF8Properly() {
|
||||
let expect = expectation(description: "Engine Decodes utf8")
|
||||
|
||||
client.on("stringTest") {data, ack in
|
||||
XCTAssertEqual(data[0] as? String, "lïne one\nlīne \rtwo𦅙𦅛", "Failed string test")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
let stringMessage = "42[\"stringTest\",\"lïne one\\nlīne \\rtwo𦅙𦅛\"]"
|
||||
|
||||
engine.parsePollingMessage("\(stringMessage.utf16.count):\(stringMessage)")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testEncodeURLProperly() {
|
||||
engine.connectParams = [
|
||||
"created": "2016-05-04T18:31:15+0200"
|
||||
]
|
||||
|
||||
XCTAssertEqual(engine.urlPolling.query, "transport=polling&b64=1&created=2016-05-04T18%3A31%3A15%2B0200")
|
||||
XCTAssertEqual(engine.urlWebSocket.query, "transport=websocket&created=2016-05-04T18%3A31%3A15%2B0200")
|
||||
|
||||
engine.connectParams = [
|
||||
"forbidden": "!*'();:@&=+$,/?%#[]\" {}"
|
||||
]
|
||||
|
||||
XCTAssertEqual(engine.urlPolling.query, "transport=polling&b64=1&forbidden=%21%2A%27%28%29%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23%5B%5D%22%20%7B%7D")
|
||||
XCTAssertEqual(engine.urlWebSocket.query, "transport=websocket&forbidden=%21%2A%27%28%29%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23%5B%5D%22%20%7B%7D")
|
||||
}
|
||||
|
||||
func testBase64Data() {
|
||||
let expect = expectation(description: "Engine Decodes base64 data")
|
||||
let b64String = "b4aGVsbG8NCg=="
|
||||
let packetString = "451-[\"test\",{\"test\":{\"_placeholder\":true,\"num\":0}}]"
|
||||
|
||||
client.on("test") {data, ack in
|
||||
if let data = data[0] as? Data, let string = String(data: data, encoding: .utf8) {
|
||||
XCTAssertEqual(string, "hello")
|
||||
}
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
engine.parseEngineMessage(packetString)
|
||||
engine.parseEngineMessage(b64String)
|
||||
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
//
|
||||
// SocketNamespacePacketTest.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SocketIO
|
||||
|
||||
class SocketNamespacePacketTest: XCTestCase {
|
||||
let data = "test".data(using: String.Encoding.utf8)!
|
||||
let data2 = "test2".data(using: String.Encoding.utf8)!
|
||||
|
||||
func testEmpyEmit() {
|
||||
let expectedSendString = "2/swift,[\"test\"]"
|
||||
let sendData: [Any] = ["test"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testNullEmit() {
|
||||
let expectedSendString = "2/swift,[\"test\",null]"
|
||||
let sendData: [Any] = ["test", NSNull()]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testStringEmit() {
|
||||
let expectedSendString = "2/swift,[\"test\",\"foo bar\"]"
|
||||
let sendData: [Any] = ["test", "foo bar"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testJSONEmit() {
|
||||
let expectedSendString = "2/swift,[\"test\",{\"null\":null,\"test\":\"hello\",\"hello\":1,\"foobar\":true}]"
|
||||
let sendData: [Any] = ["test", ["foobar": true, "hello": 1, "test": "hello", "null": NSNull()] as NSDictionary]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testArrayEmit() {
|
||||
let expectedSendString = "2/swift,[\"test\",[\"hello\",1,{\"test\":\"test\"},true]]"
|
||||
let sendData: [Any] = ["test", ["hello", 1, ["test": "test"], true]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testBinaryEmit() {
|
||||
let expectedSendString = "51-/swift,[\"test\",{\"_placeholder\":true,\"num\":0}]"
|
||||
let sendData: [Any] = ["test", data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
}
|
||||
|
||||
func testMultipleBinaryEmit() {
|
||||
let expectedSendString = "52-/swift,[\"test\",{\"data2\":{\"_placeholder\":true,\"num\":0},\"data1\":{\"_placeholder\":true,\"num\":1}}]"
|
||||
let sendData: [Any] = ["test", ["data1": data, "data2": data2] as NSDictionary]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data2, data])
|
||||
}
|
||||
|
||||
func testEmitWithAck() {
|
||||
let expectedSendString = "2/swift,0[\"test\"]"
|
||||
let sendData = ["test"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testEmitDataWithAck() {
|
||||
let expectedSendString = "51-/swift,0[\"test\",{\"_placeholder\":true,\"num\":0}]"
|
||||
let sendData: [Any] = ["test", data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: false)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
}
|
||||
|
||||
// Acks
|
||||
func testEmptyAck() {
|
||||
let expectedSendString = "3/swift,0[]"
|
||||
let packet = SocketPacket.packetFromEmit([], id: 0, nsp: "/swift", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testNullAck() {
|
||||
let expectedSendString = "3/swift,0[null]"
|
||||
let sendData = [NSNull()]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testStringAck() {
|
||||
let expectedSendString = "3/swift,0[\"test\"]"
|
||||
let sendData = ["test"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testJSONAck() {
|
||||
let expectedSendString = "3/swift,0[{\"null\":null,\"hello\":1,\"test\":\"hello\",\"foobar\":true}]"
|
||||
let sendData = [["foobar": true, "hello": 1, "test": "hello", "null": NSNull()]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
}
|
||||
|
||||
func testBinaryAck() {
|
||||
let expectedSendString = "61-/swift,0[{\"_placeholder\":true,\"num\":0}]"
|
||||
let sendData = [data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
}
|
||||
|
||||
func testMultipleBinaryAck() {
|
||||
let expectedSendString = "62-/swift,0[{\"data2\":{\"_placeholder\":true,\"num\":0},\"data1\":{\"_placeholder\":true,\"num\":1}}]"
|
||||
let sendData = [["data1": data, "data2": data2]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
|
||||
XCTAssertEqual(packet.packetString, expectedSendString)
|
||||
XCTAssertEqual(packet.binary, [data2, data])
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
//
|
||||
// SocketObjectiveCTest.m
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 3/25/16.
|
||||
//
|
||||
// Merely tests whether the Objective-C api breaks
|
||||
//
|
||||
|
||||
@import Dispatch;
|
||||
@import Foundation;
|
||||
@import XCTest;
|
||||
@import SocketIO;
|
||||
|
||||
@interface SocketObjectiveCTest : XCTestCase
|
||||
|
||||
@property SocketIOClient* socket;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SocketObjectiveCTest
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
NSURL* url = [[NSURL alloc] initWithString:@"http://localhost"];
|
||||
self.socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{@"log": @NO, @"forcePolling": @YES}];
|
||||
}
|
||||
|
||||
- (void)testProperties {
|
||||
NSURL* url = nil;
|
||||
|
||||
url = self.socket.socketURL;
|
||||
self.socket.forceNew = false;
|
||||
self.socket.handleQueue = dispatch_get_main_queue();
|
||||
self.socket.nsp = @"/objective-c";
|
||||
self.socket.reconnects = false;
|
||||
self.socket.reconnectWait = 1;
|
||||
}
|
||||
|
||||
- (void)testOnSyntax {
|
||||
[self.socket on:@"someCallback" callback:^(NSArray* data, SocketAckEmitter* ack) {
|
||||
[ack with:@[@1]];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testConnectSyntax {
|
||||
[self.socket connect];
|
||||
}
|
||||
|
||||
- (void)testConnectTimeoutAfterSyntax {
|
||||
[self.socket connectWithTimeoutAfter:1 withHandler: ^() { }];
|
||||
}
|
||||
|
||||
- (void)testDisconnectSyntax {
|
||||
[self.socket disconnect];
|
||||
}
|
||||
|
||||
- (void)testLeaveNamespaceSyntax {
|
||||
[self.socket leaveNamespace];
|
||||
}
|
||||
|
||||
- (void)testJoinNamespaceSyntax {
|
||||
[self.socket joinNamespace:@"/objective-c"];
|
||||
}
|
||||
|
||||
- (void)testOnAnySyntax {
|
||||
[self.socket onAny:^(SocketAnyEvent* any) {
|
||||
NSString* event = any.event;
|
||||
NSArray* data = any.items;
|
||||
|
||||
[self.socket emit:event with:data];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testReconnectSyntax {
|
||||
[self.socket reconnect];
|
||||
}
|
||||
|
||||
- (void)testRemoveAllHandlersSyntax {
|
||||
[self.socket removeAllHandlers];
|
||||
}
|
||||
|
||||
- (void)testEmitSyntax {
|
||||
[self.socket emit:@"testEmit" with:@[@YES]];
|
||||
}
|
||||
|
||||
- (void)testEmitWithAckSyntax {
|
||||
[[self.socket emitWithAck:@"testAckEmit" with:@[@YES]] timingOutAfter:0 callback:^(NSArray* data) { }];
|
||||
}
|
||||
|
||||
- (void)testOffSyntax {
|
||||
[self.socket off:@"test"];
|
||||
}
|
||||
|
||||
- (void)testSocketManager {
|
||||
SocketClientManager* manager = [SocketClientManager sharedManager];
|
||||
[manager addSocket:self.socket labeledAs:@"test"];
|
||||
[manager removeSocketWithLabel:@"test"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,319 +0,0 @@
|
||||
//
|
||||
// SocketSideEffectTest.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SocketIO
|
||||
|
||||
class SocketSideEffectTest: XCTestCase {
|
||||
func testInitialCurrentAck() {
|
||||
XCTAssertEqual(socket.currentAck, -1)
|
||||
}
|
||||
|
||||
func testFirstAck() {
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in}
|
||||
XCTAssertEqual(socket.currentAck, 0)
|
||||
}
|
||||
|
||||
func testSecondAck() {
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in}
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in}
|
||||
|
||||
XCTAssertEqual(socket.currentAck, 1)
|
||||
}
|
||||
|
||||
func testHandleAck() {
|
||||
let expect = expectation(description: "handled ack")
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in
|
||||
XCTAssertEqual(data[0] as? String, "hello world")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.parseSocketMessage("30[\"hello world\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleAck2() {
|
||||
let expect = expectation(description: "handled ack2")
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in
|
||||
XCTAssertTrue(data.count == 2, "Wrong number of ack items")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.parseSocketMessage("61-0[{\"_placeholder\":true,\"num\":0},{\"test\":true}]")
|
||||
socket.parseBinaryData(Data())
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleEvent() {
|
||||
let expect = expectation(description: "handled event")
|
||||
socket.on("test") {data, ack in
|
||||
XCTAssertEqual(data[0] as? String, "hello world")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.parseSocketMessage("2[\"test\",\"hello world\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleStringEventWithQuotes() {
|
||||
let expect = expectation(description: "handled event")
|
||||
socket.on("test") {data, ack in
|
||||
XCTAssertEqual(data[0] as? String, "\"hello world\"")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.parseSocketMessage("2[\"test\",\"\\\"hello world\\\"\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleOnceEvent() {
|
||||
let expect = expectation(description: "handled event")
|
||||
socket.once("test") {data, ack in
|
||||
XCTAssertEqual(data[0] as? String, "hello world")
|
||||
XCTAssertEqual(self.socket.testHandlers.count, 0)
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.parseSocketMessage("2[\"test\",\"hello world\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testOffWithEvent() {
|
||||
socket.on("test") {data, ack in }
|
||||
XCTAssertEqual(socket.testHandlers.count, 1)
|
||||
socket.on("test") {data, ack in }
|
||||
XCTAssertEqual(socket.testHandlers.count, 2)
|
||||
socket.off("test")
|
||||
XCTAssertEqual(socket.testHandlers.count, 0)
|
||||
}
|
||||
|
||||
func testOffWithId() {
|
||||
let handler = socket.on("test") {data, ack in }
|
||||
XCTAssertEqual(socket.testHandlers.count, 1)
|
||||
socket.on("test") {data, ack in }
|
||||
XCTAssertEqual(socket.testHandlers.count, 2)
|
||||
socket.off(id: handler)
|
||||
XCTAssertEqual(socket.testHandlers.count, 1)
|
||||
}
|
||||
|
||||
func testHandlesErrorPacket() {
|
||||
let expect = expectation(description: "Handled error")
|
||||
socket.on("error") {data, ack in
|
||||
if let error = data[0] as? String, error == "test error" {
|
||||
expect.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
socket.parseSocketMessage("4\"test error\"")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleBinaryEvent() {
|
||||
let expect = expectation(description: "handled binary event")
|
||||
socket.on("test") {data, ack in
|
||||
if let dict = data[0] as? NSDictionary, let data = dict["test"] as? NSData {
|
||||
XCTAssertEqual(data as Data, self.data)
|
||||
expect.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
socket.parseSocketMessage("51-[\"test\",{\"test\":{\"_placeholder\":true,\"num\":0}}]")
|
||||
socket.parseBinaryData(data)
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleMultipleBinaryEvent() {
|
||||
let expect = expectation(description: "handled multiple binary event")
|
||||
socket.on("test") {data, ack in
|
||||
if let dict = data[0] as? NSDictionary, let data = dict["test"] as? NSData,
|
||||
let data2 = dict["test2"] as? NSData {
|
||||
XCTAssertEqual(data as Data, self.data)
|
||||
XCTAssertEqual(data2 as Data, self.data2)
|
||||
expect.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
socket.parseSocketMessage("52-[\"test\",{\"test\":{\"_placeholder\":true,\"num\":0},\"test2\":{\"_placeholder\":true,\"num\":1}}]")
|
||||
socket.parseBinaryData(data)
|
||||
socket.parseBinaryData(data2)
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testSocketManager() {
|
||||
let manager = SocketClientManager.sharedManager
|
||||
manager["test"] = socket
|
||||
|
||||
XCTAssert(manager["test"] === socket, "failed to get socket")
|
||||
|
||||
manager["test"] = nil
|
||||
|
||||
XCTAssert(manager["test"] == nil, "socket not removed")
|
||||
|
||||
}
|
||||
|
||||
func testChangingStatusCallsStatusChangeHandler() {
|
||||
let expect = expectation(description: "The client should announce when the status changes")
|
||||
let statusChange = SocketIOClientStatus.connecting
|
||||
|
||||
socket.on("statusChange") {data, ack in
|
||||
guard let status = data[0] as? SocketIOClientStatus else {
|
||||
XCTFail("Status should be one of the defined statuses")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(status, statusChange, "The status changed should be the one set")
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.setTestStatus(statusChange)
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testOnClientEvent() {
|
||||
let expect = expectation(description: "The client should call client event handlers")
|
||||
let event = SocketClientEvent.disconnect
|
||||
let closeReason = "testing"
|
||||
|
||||
socket.on(clientEvent: event) {data, ack in
|
||||
guard let reason = data[0] as? String else {
|
||||
XCTFail("Client should pass data for client events")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(closeReason, reason, "The data should be what was sent to handleClientEvent")
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.handleClientEvent(event, data: [closeReason])
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testClientEventsAreBackwardsCompatible() {
|
||||
let expect = expectation(description: "The client should call old style client event handlers")
|
||||
let event = SocketClientEvent.disconnect
|
||||
let closeReason = "testing"
|
||||
|
||||
socket.on("disconnect") {data, ack in
|
||||
guard let reason = data[0] as? String else {
|
||||
XCTFail("Client should pass data for client events")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(closeReason, reason, "The data should be what was sent to handleClientEvent")
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.handleClientEvent(event, data: [closeReason])
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testConnectTimesOutIfNotConnected() {
|
||||
let expect = expectation(description: "The client should call the timeout function")
|
||||
|
||||
socket.setTestStatus(.notConnected)
|
||||
|
||||
socket.connect(timeoutAfter: 1, withHandler: {
|
||||
expect.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 2)
|
||||
}
|
||||
|
||||
func testConnectDoesNotTimeOutIfConnected() {
|
||||
let expect = expectation(description: "The client should not call the timeout function")
|
||||
|
||||
socket.setTestStatus(.notConnected)
|
||||
|
||||
socket.connect(timeoutAfter: 1, withHandler: {
|
||||
XCTFail("Should not call timeout handler if status is connected")
|
||||
})
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2) {
|
||||
// Fake connecting
|
||||
self.socket.setTestStatus(.connected)
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1.1) {
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 2)
|
||||
}
|
||||
|
||||
func testErrorInCustomSocketDataCallsErrorHandler() {
|
||||
let expect = expectation(description: "The client should call the error handler for emit errors because of " +
|
||||
"custom data")
|
||||
|
||||
socket.on(clientEvent: .error) {data, ack in
|
||||
guard data.count == 3, data[0] as? String == "myEvent",
|
||||
data[2] is ThrowingData.ThrowingError else {
|
||||
XCTFail("Incorrect error call")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.emit("myEvent", ThrowingData())
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testErrorInCustomSocketDataCallsErrorHandler_ack() {
|
||||
let expect = expectation(description: "The client should call the error handler for emit errors because of " +
|
||||
"custom data")
|
||||
|
||||
socket.on(clientEvent: .error) {data, ack in
|
||||
guard data.count == 3, data[0] as? String == "myEvent",
|
||||
data[2] is ThrowingData.ThrowingError else {
|
||||
XCTFail("Incorrect error call")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.emitWithAck("myEvent", ThrowingData()).timingOut(after: 1, callback: {_ in
|
||||
XCTFail("Ack callback should not be called")
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
let data = "test".data(using: String.Encoding.utf8)!
|
||||
let data2 = "test2".data(using: String.Encoding.utf8)!
|
||||
private var socket: SocketIOClient!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
socket = SocketIOClient(socketURL: URL(string: "http://localhost/")!)
|
||||
socket.setTestable()
|
||||
}
|
||||
}
|
||||
|
||||
struct ThrowingData : SocketData {
|
||||
enum ThrowingError : Error {
|
||||
case error
|
||||
}
|
||||
|
||||
func socketRepresentation() throws -> SocketData {
|
||||
throw ThrowingError.error
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// SocketIO-iOS.h
|
||||
// SocketIO-iOS
|
||||
//
|
||||
// Created by Nacho Soto on 7/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for SocketIO-iOS.
|
||||
FOUNDATION_EXPORT double SocketIO_iOSVersionNumber;
|
||||
|
||||
//! Project version string for SocketIO-iOS.
|
||||
FOUNDATION_EXPORT const unsigned char SocketIO_iOSVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <SocketIO_iOS/PublicHeader.h>
|
||||
|
||||
|
||||
File renamed without changes.
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for SocketIO-Mac.
|
||||
FOUNDATION_EXPORT double SocketIO_MacVersionNumber;
|
||||
@@ -1,259 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SSLSecurity.swift
|
||||
// Starscream
|
||||
//
|
||||
// Created by Dalton Cherry on 5/16/15.
|
||||
// Copyright (c) 2014-2016 Dalton Cherry.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
import Foundation
|
||||
import Security
|
||||
|
||||
public protocol SSLTrustValidator {
|
||||
func isValid(_ trust: SecTrust, domain: String?) -> Bool
|
||||
}
|
||||
|
||||
open class SSLCert : NSObject {
|
||||
var certData: Data?
|
||||
var key: SecKey?
|
||||
|
||||
/**
|
||||
Designated init for certificates
|
||||
|
||||
- parameter data: is the binary data of the certificate
|
||||
|
||||
- returns: a representation security object to be used with
|
||||
*/
|
||||
public init(data: Data) {
|
||||
self.certData = data
|
||||
}
|
||||
|
||||
/**
|
||||
Designated init for public keys
|
||||
|
||||
- parameter key: is the public key to be used
|
||||
|
||||
- returns: a representation security object to be used with
|
||||
*/
|
||||
public init(key: SecKey) {
|
||||
self.key = key
|
||||
}
|
||||
}
|
||||
|
||||
open class SSLSecurity : SSLTrustValidator {
|
||||
public var validatedDN = true //should the domain name be validated?
|
||||
|
||||
var isReady = false //is the key processing done?
|
||||
var certificates: [Data]? //the certificates
|
||||
@nonobjc var pubKeys: [SecKey]? //the public keys
|
||||
var usePublicKeys = false //use public keys or certificate validation?
|
||||
|
||||
/**
|
||||
Use certs from main app bundle
|
||||
|
||||
- parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation
|
||||
|
||||
- returns: a representation security object to be used with
|
||||
*/
|
||||
public convenience init(usePublicKeys: Bool = false) {
|
||||
let paths = Bundle.main.paths(forResourcesOfType: "cer", inDirectory: ".")
|
||||
|
||||
let certs = paths.reduce([SSLCert]()) { (certs: [SSLCert], path: String) -> [SSLCert] in
|
||||
var certs = certs
|
||||
if let data = NSData(contentsOfFile: path) {
|
||||
certs.append(SSLCert(data: data as Data))
|
||||
}
|
||||
return certs
|
||||
}
|
||||
|
||||
self.init(certs: certs, usePublicKeys: usePublicKeys)
|
||||
}
|
||||
|
||||
/**
|
||||
Designated init
|
||||
|
||||
- parameter certs: is the certificates or public keys to use
|
||||
- parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation
|
||||
|
||||
- returns: a representation security object to be used with
|
||||
*/
|
||||
public init(certs: [SSLCert], usePublicKeys: Bool) {
|
||||
self.usePublicKeys = usePublicKeys
|
||||
|
||||
if self.usePublicKeys {
|
||||
DispatchQueue.global(qos: .default).async {
|
||||
let pubKeys = certs.reduce([SecKey]()) { (pubKeys: [SecKey], cert: SSLCert) -> [SecKey] in
|
||||
var pubKeys = pubKeys
|
||||
if let data = cert.certData, cert.key == nil {
|
||||
cert.key = self.extractPublicKey(data)
|
||||
}
|
||||
if let key = cert.key {
|
||||
pubKeys.append(key)
|
||||
}
|
||||
return pubKeys
|
||||
}
|
||||
|
||||
self.pubKeys = pubKeys
|
||||
self.isReady = true
|
||||
}
|
||||
} else {
|
||||
let certificates = certs.reduce([Data]()) { (certificates: [Data], cert: SSLCert) -> [Data] in
|
||||
var certificates = certificates
|
||||
if let data = cert.certData {
|
||||
certificates.append(data)
|
||||
}
|
||||
return certificates
|
||||
}
|
||||
self.certificates = certificates
|
||||
self.isReady = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Valid the trust and domain name.
|
||||
|
||||
- parameter trust: is the serverTrust to validate
|
||||
- parameter domain: is the CN domain to validate
|
||||
|
||||
- returns: if the key was successfully validated
|
||||
*/
|
||||
public func isValid(_ trust: SecTrust, domain: String?) -> Bool {
|
||||
|
||||
var tries = 0
|
||||
while !self.isReady {
|
||||
usleep(1000)
|
||||
tries += 1
|
||||
if tries > 5 {
|
||||
return false //doesn't appear it is going to ever be ready...
|
||||
}
|
||||
}
|
||||
var policy: SecPolicy
|
||||
if self.validatedDN {
|
||||
policy = SecPolicyCreateSSL(true, domain as NSString?)
|
||||
} else {
|
||||
policy = SecPolicyCreateBasicX509()
|
||||
}
|
||||
SecTrustSetPolicies(trust,policy)
|
||||
if self.usePublicKeys {
|
||||
if let keys = self.pubKeys {
|
||||
let serverPubKeys = publicKeyChain(trust)
|
||||
for serverKey in serverPubKeys as [AnyObject] {
|
||||
for key in keys as [AnyObject] {
|
||||
if serverKey.isEqual(key) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let certs = self.certificates {
|
||||
let serverCerts = certificateChain(trust)
|
||||
var collect = [SecCertificate]()
|
||||
for cert in certs {
|
||||
collect.append(SecCertificateCreateWithData(nil,cert as CFData)!)
|
||||
}
|
||||
SecTrustSetAnchorCertificates(trust,collect as NSArray)
|
||||
var result: SecTrustResultType = .unspecified
|
||||
SecTrustEvaluate(trust,&result)
|
||||
if result == .unspecified || result == .proceed {
|
||||
var trustedCount = 0
|
||||
for serverCert in serverCerts {
|
||||
for cert in certs {
|
||||
if cert == serverCert {
|
||||
trustedCount += 1
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if trustedCount == serverCerts.count {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
Get the public key from a certificate data
|
||||
|
||||
- parameter data: is the certificate to pull the public key from
|
||||
|
||||
- returns: a public key
|
||||
*/
|
||||
func extractPublicKey(_ data: Data) -> SecKey? {
|
||||
guard let cert = SecCertificateCreateWithData(nil, data as CFData) else { return nil }
|
||||
|
||||
return extractPublicKey(cert, policy: SecPolicyCreateBasicX509())
|
||||
}
|
||||
|
||||
/**
|
||||
Get the public key from a certificate
|
||||
|
||||
- parameter data: is the certificate to pull the public key from
|
||||
|
||||
- returns: a public key
|
||||
*/
|
||||
func extractPublicKey(_ cert: SecCertificate, policy: SecPolicy) -> SecKey? {
|
||||
var possibleTrust: SecTrust?
|
||||
SecTrustCreateWithCertificates(cert, policy, &possibleTrust)
|
||||
|
||||
guard let trust = possibleTrust else { return nil }
|
||||
var result: SecTrustResultType = .unspecified
|
||||
SecTrustEvaluate(trust, &result)
|
||||
return SecTrustCopyPublicKey(trust)
|
||||
}
|
||||
|
||||
/**
|
||||
Get the certificate chain for the trust
|
||||
|
||||
- parameter trust: is the trust to lookup the certificate chain for
|
||||
|
||||
- returns: the certificate chain for the trust
|
||||
*/
|
||||
func certificateChain(_ trust: SecTrust) -> [Data] {
|
||||
let certificates = (0..<SecTrustGetCertificateCount(trust)).reduce([Data]()) { (certificates: [Data], index: Int) -> [Data] in
|
||||
var certificates = certificates
|
||||
let cert = SecTrustGetCertificateAtIndex(trust, index)
|
||||
certificates.append(SecCertificateCopyData(cert!) as Data)
|
||||
return certificates
|
||||
}
|
||||
|
||||
return certificates
|
||||
}
|
||||
|
||||
/**
|
||||
Get the public key chain for the trust
|
||||
|
||||
- parameter trust: is the trust to lookup the certificate chain and extract the public keys
|
||||
|
||||
- returns: the public keys from the certifcate chain for the trust
|
||||
*/
|
||||
@nonobjc func publicKeyChain(_ trust: SecTrust) -> [SecKey] {
|
||||
let policy = SecPolicyCreateBasicX509()
|
||||
let keys = (0..<SecTrustGetCertificateCount(trust)).reduce([SecKey]()) { (keys: [SecKey], index: Int) -> [SecKey] in
|
||||
var keys = keys
|
||||
let cert = SecTrustGetCertificateAtIndex(trust, index)
|
||||
if let key = extractPublicKey(cert!, policy: policy) {
|
||||
keys.append(key)
|
||||
}
|
||||
|
||||
return keys
|
||||
}
|
||||
|
||||
return keys
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
//
|
||||
// SocketClientManager.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 6/11/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.
|
||||
|
||||
import Foundation
|
||||
|
||||
/**
|
||||
Experimental socket manager.
|
||||
|
||||
API subject to change.
|
||||
|
||||
Can be used to persist sockets across ViewControllers.
|
||||
|
||||
Sockets are strongly stored, so be sure to remove them once they are no
|
||||
longer needed.
|
||||
|
||||
Example usage:
|
||||
```
|
||||
let manager = SocketClientManager.sharedManager
|
||||
manager["room1"] = socket1
|
||||
manager["room2"] = socket2
|
||||
manager.removeSocket(socket: socket2)
|
||||
manager["room1"]?.emit("hello")
|
||||
```
|
||||
*/
|
||||
open class SocketClientManager : NSObject {
|
||||
// MARK: Properties.
|
||||
|
||||
/// The shared manager.
|
||||
open static let sharedManager = SocketClientManager()
|
||||
|
||||
private var sockets = [String: SocketIOClient]()
|
||||
|
||||
/// Gets a socket by its name.
|
||||
///
|
||||
/// - returns: The socket, if one had the given name.
|
||||
open subscript(string: String) -> SocketIOClient? {
|
||||
get {
|
||||
return sockets[string]
|
||||
}
|
||||
|
||||
set(socket) {
|
||||
sockets[string] = socket
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Methods.
|
||||
|
||||
/// Adds a socket.
|
||||
///
|
||||
/// - parameter socket: The socket to add.
|
||||
/// - parameter labeledAs: The label for this socket.
|
||||
open func addSocket(_ socket: SocketIOClient, labeledAs label: String) {
|
||||
sockets[label] = socket
|
||||
}
|
||||
|
||||
/// Removes a socket by a given name.
|
||||
///
|
||||
/// - parameter withLabel: The label of the socket to remove.
|
||||
/// - returns: The socket for the given label, if one was present.
|
||||
@discardableResult
|
||||
open func removeSocket(withLabel label: String) -> SocketIOClient? {
|
||||
return sockets.removeValue(forKey: label)
|
||||
}
|
||||
|
||||
/// Removes a socket.
|
||||
///
|
||||
/// - parameter socket: The socket to remove.
|
||||
/// - returns: The socket if it was in the manager.
|
||||
@discardableResult
|
||||
open func removeSocket(_ socket: SocketIOClient) -> SocketIOClient? {
|
||||
var returnSocket: SocketIOClient?
|
||||
|
||||
for (label, dictSocket) in sockets where dictSocket === socket {
|
||||
returnSocket = sockets.removeValue(forKey: label)
|
||||
}
|
||||
|
||||
return returnSocket
|
||||
}
|
||||
|
||||
/// Removes all the sockets in the manager.
|
||||
open func removeSockets() {
|
||||
sockets.removeAll()
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,21 @@ import Foundation
|
||||
/// A class that represents a waiting ack call.
|
||||
///
|
||||
/// **NOTE**: You should not store this beyond the life of the event handler.
|
||||
public final class SocketAckEmitter : NSObject {
|
||||
let socket: SocketIOClient
|
||||
let ackNum: Int
|
||||
public final class SocketAckEmitter: NSObject {
|
||||
private unowned let socket: SocketIOClient
|
||||
private let ackNum: Int
|
||||
|
||||
/// A view into this emitter where emits do not check for binary data.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// ack.rawEmitView.with(myObject)
|
||||
/// ```
|
||||
///
|
||||
/// **NOTE**: It is not safe to hold on to this view beyond the life of the socket.
|
||||
@objc
|
||||
public private(set) lazy var rawEmitView = SocketRawAckView(socket: socket, ackNum: ackNum)
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
@@ -39,7 +51,13 @@ public final class SocketAckEmitter : NSObject {
|
||||
return ackNum != -1
|
||||
}
|
||||
|
||||
init(socket: SocketIOClient, ackNum: Int) {
|
||||
// MARK: Initializers
|
||||
|
||||
/// Creates a new `SocketAckEmitter`.
|
||||
///
|
||||
/// - parameter socket: The socket for this emitter.
|
||||
/// - parameter ackNum: The ack number for this emitter.
|
||||
public init(socket: SocketIOClient, ackNum: Int) {
|
||||
self.socket = socket
|
||||
self.ackNum = ackNum
|
||||
}
|
||||
@@ -57,14 +75,15 @@ public final class SocketAckEmitter : NSObject {
|
||||
|
||||
do {
|
||||
socket.emitAck(ackNum, with: try items.map({ try $0.socketRepresentation() }))
|
||||
} catch let err {
|
||||
socket.handleClientEvent(.error, data: [ackNum, items, err])
|
||||
} catch {
|
||||
socket.handleClientEvent(.error, data: [ackNum, items, error])
|
||||
}
|
||||
}
|
||||
|
||||
/// Call to ack receiving this event.
|
||||
///
|
||||
/// - parameter items: An array of items to send when acking. Use `[]` to send nothing.
|
||||
@objc
|
||||
public func with(_ items: [Any]) {
|
||||
guard ackNum != -1 else { return }
|
||||
|
||||
@@ -82,17 +101,21 @@ public final class SocketAckEmitter : NSObject {
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
public final class OnAckCallback : NSObject {
|
||||
public final class OnAckCallback: NSObject {
|
||||
private let ackNumber: Int
|
||||
private let binary: Bool
|
||||
private let items: [Any]
|
||||
|
||||
private weak var socket: SocketIOClient?
|
||||
|
||||
init(ackNumber: Int, items: [Any], socket: SocketIOClient) {
|
||||
init(ackNumber: Int, items: [Any], socket: SocketIOClient, binary: Bool = true) {
|
||||
self.ackNumber = ackNumber
|
||||
self.items = items
|
||||
self.socket = socket
|
||||
self.binary = binary
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
deinit {
|
||||
DefaultSocketLogger.Logger.log("OnAckCallback for \(ackNumber) being released", type: "OnAckCallback")
|
||||
}
|
||||
@@ -101,19 +124,22 @@ public final class OnAckCallback : NSObject {
|
||||
|
||||
/// Completes an emitWithAck. If this isn't called, the emit never happens.
|
||||
///
|
||||
/// - parameter after: The number of seconds before this emit times out if an ack hasn't been received.
|
||||
/// - parameter seconds: The number of seconds before this emit times out if an ack hasn't been received.
|
||||
/// - parameter callback: The callback called when an ack is received, or when a timeout happens.
|
||||
/// To check for timeout, use `SocketAckStatus`'s `noAck` case.
|
||||
public func timingOut(after seconds: Int, callback: @escaping AckCallback) {
|
||||
@objc
|
||||
public func timingOut(after seconds: Double, callback: @escaping AckCallback) {
|
||||
guard let socket = self.socket, ackNumber != -1 else { return }
|
||||
|
||||
socket.ackHandlers.addAck(ackNumber, callback: callback)
|
||||
socket._emit(items, ack: ackNumber)
|
||||
socket.emit(items, ack: ackNumber, binary: binary)
|
||||
|
||||
guard seconds != 0 else { return }
|
||||
|
||||
socket.handleQueue.asyncAfter(deadline: DispatchTime.now() + Double(seconds)) {
|
||||
socket.ackHandlers.timeoutAck(self.ackNumber, onQueue: socket.handleQueue)
|
||||
socket.manager?.handleQueue.asyncAfter(deadline: DispatchTime.now() + seconds) {[weak socket] in
|
||||
guard let socket = socket else { return }
|
||||
|
||||
socket.ackHandlers.timeoutAck(self.ackNumber)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,16 +27,25 @@ import Foundation
|
||||
|
||||
/// The status of an ack.
|
||||
public enum SocketAckStatus : String {
|
||||
// MARK: Cases
|
||||
|
||||
/// The ack timed out.
|
||||
case noAck = "NO ACK"
|
||||
|
||||
/// Tests whether a string is equal to a given SocketAckStatus
|
||||
public static func == (lhs: String, rhs: SocketAckStatus) -> Bool {
|
||||
return lhs == rhs.rawValue
|
||||
}
|
||||
|
||||
/// Tests whether a string is equal to a given SocketAckStatus
|
||||
public static func == (lhs: SocketAckStatus, rhs: String) -> Bool {
|
||||
return rhs == lhs
|
||||
}
|
||||
}
|
||||
|
||||
private struct SocketAck : Hashable {
|
||||
let ack: Int
|
||||
var callback: AckCallback!
|
||||
var hashValue: Int {
|
||||
return ack.hashValue
|
||||
}
|
||||
|
||||
init(ack: Int) {
|
||||
self.ack = ack
|
||||
@@ -47,6 +56,10 @@ private struct SocketAck : Hashable {
|
||||
self.callback = callback
|
||||
}
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
ack.hash(into: &hasher)
|
||||
}
|
||||
|
||||
fileprivate static func <(lhs: SocketAck, rhs: SocketAck) -> Bool {
|
||||
return lhs.ack < rhs.ack
|
||||
}
|
||||
@@ -56,31 +69,20 @@ private struct SocketAck : Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
struct SocketAckManager {
|
||||
class SocketAckManager {
|
||||
private var acks = Set<SocketAck>(minimumCapacity: 1)
|
||||
private let ackSemaphore = DispatchSemaphore(value: 1)
|
||||
|
||||
mutating func addAck(_ ack: Int, callback: @escaping AckCallback) {
|
||||
func addAck(_ ack: Int, callback: @escaping AckCallback) {
|
||||
acks.insert(SocketAck(ack: ack, callback: callback))
|
||||
}
|
||||
|
||||
/// Should be called on handle queue
|
||||
mutating func executeAck(_ ack: Int, with items: [Any], onQueue: DispatchQueue) {
|
||||
ackSemaphore.wait()
|
||||
defer { ackSemaphore.signal() }
|
||||
let ack = acks.remove(SocketAck(ack: ack))
|
||||
|
||||
onQueue.async() { ack?.callback(items) }
|
||||
func executeAck(_ ack: Int, with items: [Any]) {
|
||||
acks.remove(SocketAck(ack: ack))?.callback(items)
|
||||
}
|
||||
|
||||
/// Should be called on handle queue
|
||||
mutating func timeoutAck(_ ack: Int, onQueue: DispatchQueue) {
|
||||
ackSemaphore.wait()
|
||||
defer { ackSemaphore.signal() }
|
||||
let ack = acks.remove(SocketAck(ack: ack))
|
||||
|
||||
onQueue.async() {
|
||||
ack?.callback?([SocketAckStatus.noAck.rawValue])
|
||||
}
|
||||
func timeoutAck(_ ack: Int) {
|
||||
acks.remove(SocketAck(ack: ack))?.callback?([SocketAckStatus.noAck.rawValue])
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,11 @@ public final class SocketAnyEvent : NSObject {
|
||||
// MARK: Properties
|
||||
|
||||
/// The event name.
|
||||
@objc
|
||||
public let event: String
|
||||
|
||||
/// The data items for this event.
|
||||
@objc
|
||||
public let items: [Any]?
|
||||
|
||||
/// The description of this event.
|
||||
@@ -24,12 +24,27 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
struct SocketEventHandler {
|
||||
let event: String
|
||||
let id: UUID
|
||||
let callback: NormalCallback
|
||||
|
||||
func executeCallback(with items: [Any], withAck ack: Int, withSocket socket: SocketIOClient) {
|
||||
/// A wrapper around a handler.
|
||||
public struct SocketEventHandler {
|
||||
// MARK: Properties
|
||||
|
||||
/// The event for this handler.
|
||||
public let event: String
|
||||
|
||||
/// A unique identifier for this handler.
|
||||
public let id: UUID
|
||||
|
||||
/// The actual handler function.
|
||||
public let callback: NormalCallback
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
/// Causes this handler to be executed.
|
||||
///
|
||||
/// - parameter with: The data that this handler should be called with.
|
||||
/// - parameter withAck: The ack number that this event expects. Pass -1 to say this event doesn't expect an ack.
|
||||
/// - parameter withSocket: The socket that is calling this event.
|
||||
public func executeCallback(with items: [Any], withAck ack: Int, withSocket socket: SocketIOClient) {
|
||||
callback(items, SocketAckEmitter(socket: socket, ackNum: ack))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,549 @@
|
||||
//
|
||||
// SocketIOClient.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 11/23/14.
|
||||
//
|
||||
// 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.
|
||||
|
||||
import Dispatch
|
||||
import Foundation
|
||||
|
||||
/// Represents a socket.io-client.
|
||||
///
|
||||
/// Clients are created through a `SocketManager`, which owns the `SocketEngineSpec` that controls the connection to the server.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// ```swift
|
||||
/// // Create a socket for the /swift namespace
|
||||
/// let socket = manager.socket(forNamespace: "/swift")
|
||||
///
|
||||
/// // Add some handlers and connect
|
||||
/// ```
|
||||
///
|
||||
/// **NOTE**: The client is not thread/queue safe, all interaction with the socket should be done on the `manager.handleQueue`
|
||||
///
|
||||
open class SocketIOClient: NSObject, SocketIOClientSpec {
|
||||
// MARK: Properties
|
||||
|
||||
/// The namespace that this socket is currently connected to.
|
||||
///
|
||||
/// **Must** start with a `/`.
|
||||
public let nsp: String
|
||||
|
||||
/// A handler that will be called on any event.
|
||||
public private(set) var anyHandler: ((SocketAnyEvent) -> ())?
|
||||
|
||||
/// The array of handlers for this socket.
|
||||
public private(set) var handlers = [SocketEventHandler]()
|
||||
|
||||
/// The manager for this socket.
|
||||
public private(set) weak var manager: SocketManagerSpec?
|
||||
|
||||
/// A view into this socket where emits do not check for binary data.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.rawEmitView.emit("myEvent", myObject)
|
||||
/// ```
|
||||
///
|
||||
/// **NOTE**: It is not safe to hold on to this view beyond the life of the socket.
|
||||
public private(set) lazy var rawEmitView = SocketRawView(socket: self)
|
||||
|
||||
/// The status of this client.
|
||||
public private(set) var status = SocketIOStatus.notConnected {
|
||||
didSet {
|
||||
handleClientEvent(.statusChange, data: [status, status.rawValue])
|
||||
}
|
||||
}
|
||||
|
||||
/// The id of this socket.io connect. This is different from the sid of the engine.io connection.
|
||||
public private(set) var sid: String?
|
||||
|
||||
let ackHandlers = SocketAckManager()
|
||||
var connectPayload: [String: Any]?
|
||||
|
||||
private(set) var currentAck = -1
|
||||
|
||||
private lazy var logType = "SocketIOClient{\(nsp)}"
|
||||
|
||||
// MARK: Initializers
|
||||
|
||||
/// Type safe way to create a new SocketIOClient. `opts` can be omitted.
|
||||
///
|
||||
/// - parameter manager: The manager for this socket.
|
||||
/// - parameter nsp: The namespace of the socket.
|
||||
public init(manager: SocketManagerSpec, nsp: String) {
|
||||
self.manager = manager
|
||||
self.nsp = nsp
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
deinit {
|
||||
DefaultSocketLogger.Logger.log("Client is being released", type: logType)
|
||||
}
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
/// Connect to the server. The same as calling `connect(timeoutAfter:withHandler:)` with a timeout of 0.
|
||||
///
|
||||
/// Only call after adding your event listeners, unless you know what you're doing.
|
||||
///
|
||||
/// - parameter withPayload: An optional payload sent on connect
|
||||
open func connect(withPayload payload: [String: Any]? = nil) {
|
||||
connect(withPayload: payload, timeoutAfter: 0, withHandler: nil)
|
||||
}
|
||||
|
||||
/// Connect to the server. If we aren't connected after `timeoutAfter` seconds, then `withHandler` is called.
|
||||
///
|
||||
/// Only call after adding your event listeners, unless you know what you're doing.
|
||||
///
|
||||
/// - parameter withPayload: An optional payload sent on connect
|
||||
/// - parameter timeoutAfter: The number of seconds after which if we are not connected we assume the connection
|
||||
/// has failed. Pass 0 to never timeout.
|
||||
/// - parameter handler: The handler to call when the client fails to connect.
|
||||
open func connect(withPayload payload: [String: Any]? = nil, timeoutAfter: Double, withHandler handler: (() -> ())?) {
|
||||
assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)")
|
||||
|
||||
guard let manager = self.manager, status != .connected else {
|
||||
DefaultSocketLogger.Logger.log("Tried connecting on an already connected socket", type: logType)
|
||||
return
|
||||
}
|
||||
|
||||
status = .connecting
|
||||
|
||||
joinNamespace(withPayload: payload)
|
||||
|
||||
switch manager.version {
|
||||
case .three:
|
||||
break
|
||||
case .two where manager.status == .connected && nsp == "/":
|
||||
// We might not get a connect event for the default nsp, fire immediately
|
||||
didConnect(toNamespace: nsp, payload: nil)
|
||||
|
||||
return
|
||||
case _:
|
||||
break
|
||||
}
|
||||
|
||||
guard timeoutAfter != 0 else { return }
|
||||
|
||||
manager.handleQueue.asyncAfter(deadline: DispatchTime.now() + timeoutAfter) {[weak self] in
|
||||
guard let this = self, this.status == .connecting || this.status == .notConnected else { return }
|
||||
DefaultSocketLogger.Logger.log("Timeout: Socket not connected, so setting to disconnected", type: this.logType)
|
||||
|
||||
this.status = .disconnected
|
||||
this.leaveNamespace()
|
||||
|
||||
handler?()
|
||||
}
|
||||
}
|
||||
|
||||
func createOnAck(_ items: [Any], binary: Bool = true) -> OnAckCallback {
|
||||
currentAck += 1
|
||||
|
||||
return OnAckCallback(ackNumber: currentAck, items: items, socket: self)
|
||||
}
|
||||
|
||||
/// Called when the client connects to a namespace. If the client was created with a namespace upfront,
|
||||
/// then this is only called when the client connects to that namespace.
|
||||
///
|
||||
/// - parameter toNamespace: The namespace that was connected to.
|
||||
open func didConnect(toNamespace namespace: String, payload: [String: Any]?) {
|
||||
guard status != .connected else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Socket connected", type: logType)
|
||||
|
||||
status = .connected
|
||||
sid = payload?["sid"] as? String
|
||||
|
||||
handleClientEvent(.connect, data: payload == nil ? [namespace] : [namespace, payload!])
|
||||
}
|
||||
|
||||
/// Called when the client has disconnected from socket.io.
|
||||
///
|
||||
/// - parameter reason: The reason for the disconnection.
|
||||
open func didDisconnect(reason: String) {
|
||||
guard status != .disconnected else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Disconnected: \(reason)", type: logType)
|
||||
|
||||
status = .disconnected
|
||||
sid = ""
|
||||
|
||||
handleClientEvent(.disconnect, data: [reason])
|
||||
}
|
||||
|
||||
/// Disconnects the socket.
|
||||
///
|
||||
/// This will cause the socket to leave the namespace it is associated to, as well as remove itself from the
|
||||
/// `manager`.
|
||||
open func disconnect() {
|
||||
DefaultSocketLogger.Logger.log("Closing socket", type: logType)
|
||||
|
||||
leaveNamespace()
|
||||
}
|
||||
|
||||
/// Send an event to the server, with optional data items and optional write completion handler.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - parameter completion: Callback called on transport write completion.
|
||||
open func emit(_ event: String, _ items: SocketData..., completion: (() -> ())? = nil) {
|
||||
emit(event, with: items, completion: completion)
|
||||
}
|
||||
|
||||
/// Send an event to the server, with optional data items and optional write completion handler.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - parameter completion: Callback called on transport write completion.
|
||||
open func emit(_ event: String, with items: [SocketData], completion: (() -> ())?) {
|
||||
|
||||
do {
|
||||
emit([event] + (try items.map({ try $0.socketRepresentation() })), completion: completion)
|
||||
} catch {
|
||||
DefaultSocketLogger.Logger.error("Error creating socketRepresentation for emit: \(event), \(items)",
|
||||
type: logType)
|
||||
|
||||
handleClientEvent(.error, data: [event, items, error])
|
||||
}
|
||||
}
|
||||
|
||||
/// Sends a message to the server, requesting an ack.
|
||||
///
|
||||
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
/// Check that your server's api will ack the event being sent.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
|
||||
open func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback {
|
||||
emitWithAck(event, with: items)
|
||||
}
|
||||
|
||||
/// Sends a message to the server, requesting an ack.
|
||||
///
|
||||
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
/// Check that your server's api will ack the event being sent.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
|
||||
open func emitWithAck(_ event: String, with items: [SocketData]) -> OnAckCallback {
|
||||
|
||||
do {
|
||||
return createOnAck([event] + (try items.map({ try $0.socketRepresentation() })))
|
||||
} catch {
|
||||
DefaultSocketLogger.Logger.error("Error creating socketRepresentation for emit: \(event), \(items)",
|
||||
type: logType)
|
||||
|
||||
handleClientEvent(.error, data: [event, items, error])
|
||||
|
||||
return OnAckCallback(ackNumber: -1, items: [], socket: self)
|
||||
}
|
||||
}
|
||||
|
||||
func emit(_ data: [Any],
|
||||
ack: Int? = nil,
|
||||
binary: Bool = true,
|
||||
isAck: Bool = false,
|
||||
completion: (() -> ())? = nil
|
||||
) {
|
||||
// wrap the completion handler so it always runs async via handlerQueue
|
||||
let wrappedCompletion: (() -> ())? = (completion == nil) ? nil : {[weak self] in
|
||||
guard let this = self else { return }
|
||||
this.manager?.handleQueue.async {
|
||||
completion!()
|
||||
}
|
||||
}
|
||||
|
||||
guard status == .connected else {
|
||||
wrappedCompletion?()
|
||||
handleClientEvent(.error, data: ["Tried emitting when not connected"])
|
||||
return
|
||||
}
|
||||
|
||||
let packet = SocketPacket.packetFromEmit(data, id: ack ?? -1, nsp: nsp, ack: isAck, checkForBinary: binary)
|
||||
let str = packet.packetString
|
||||
|
||||
DefaultSocketLogger.Logger.log("Emitting: \(str), Ack: \(isAck)", type: logType)
|
||||
|
||||
manager?.engine?.send(str, withData: packet.binary, completion: wrappedCompletion)
|
||||
}
|
||||
|
||||
/// Call when you wish to tell the server that you've received the event for `ack`.
|
||||
///
|
||||
/// **You shouldn't need to call this directly.** Instead use an `SocketAckEmitter` that comes in an event callback.
|
||||
///
|
||||
/// - parameter ack: The ack number.
|
||||
/// - parameter with: The data for this ack.
|
||||
open func emitAck(_ ack: Int, with items: [Any]) {
|
||||
emit(items, ack: ack, binary: true, isAck: true)
|
||||
}
|
||||
|
||||
/// Called when socket.io has acked one of our emits. Causes the corresponding ack callback to be called.
|
||||
///
|
||||
/// - parameter ack: The number for this ack.
|
||||
/// - parameter data: The data sent back with this ack.
|
||||
open func handleAck(_ ack: Int, data: [Any]) {
|
||||
guard status == .connected else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Handling ack: \(ack) with data: \(data)", type: logType)
|
||||
|
||||
ackHandlers.executeAck(ack, with: data)
|
||||
}
|
||||
|
||||
/// Called on socket.io specific events.
|
||||
///
|
||||
/// - parameter event: The `SocketClientEvent`.
|
||||
/// - parameter data: The data for this event.
|
||||
open func handleClientEvent(_ event: SocketClientEvent, data: [Any]) {
|
||||
handleEvent(event.rawValue, data: data, isInternalMessage: true)
|
||||
}
|
||||
|
||||
/// Called when we get an event from socket.io.
|
||||
///
|
||||
/// - parameter event: The name of the event.
|
||||
/// - parameter data: The data that was sent with this event.
|
||||
/// - parameter isInternalMessage: Whether this event was sent internally. If `true` it is always sent to handlers.
|
||||
/// - parameter ack: If > 0 then this event expects to get an ack back from the client.
|
||||
open func handleEvent(_ event: String, data: [Any], isInternalMessage: Bool, withAck ack: Int = -1) {
|
||||
guard status == .connected || isInternalMessage else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Handling event: \(event) with data: \(data)", type: logType)
|
||||
|
||||
anyHandler?(SocketAnyEvent(event: event, items: data))
|
||||
|
||||
for handler in handlers where handler.event == event {
|
||||
handler.executeCallback(with: data, withAck: ack, withSocket: self)
|
||||
}
|
||||
}
|
||||
|
||||
/// Causes a client to handle a socket.io packet. The namespace for the packet must match the namespace of the
|
||||
/// socket.
|
||||
///
|
||||
/// - parameter packet: The packet to handle.
|
||||
open func handlePacket(_ packet: SocketPacket) {
|
||||
guard packet.nsp == nsp else { return }
|
||||
|
||||
switch packet.type {
|
||||
case .event, .binaryEvent:
|
||||
handleEvent(packet.event, data: packet.args, isInternalMessage: false, withAck: packet.id)
|
||||
case .ack, .binaryAck:
|
||||
handleAck(packet.id, data: packet.data)
|
||||
case .connect:
|
||||
didConnect(toNamespace: nsp, payload: packet.data.isEmpty ? nil : packet.data[0] as? [String: Any])
|
||||
case .disconnect:
|
||||
didDisconnect(reason: "Got Disconnect")
|
||||
case .error:
|
||||
handleEvent("error", data: packet.data, isInternalMessage: true, withAck: packet.id)
|
||||
}
|
||||
}
|
||||
|
||||
/// Call when you wish to leave a namespace and disconnect this socket.
|
||||
open func leaveNamespace() {
|
||||
manager?.disconnectSocket(self)
|
||||
}
|
||||
|
||||
/// Joins `nsp`. You shouldn't need to call this directly, instead call `connect`.
|
||||
///
|
||||
/// - parameter withPayload: An optional payload sent on connect
|
||||
open func joinNamespace(withPayload payload: [String: Any]? = nil) {
|
||||
DefaultSocketLogger.Logger.log("Joining namespace \(nsp)", type: logType)
|
||||
|
||||
connectPayload = payload
|
||||
|
||||
manager?.connectSocket(self, withPayload: connectPayload)
|
||||
}
|
||||
|
||||
/// Removes handler(s) for a client event.
|
||||
///
|
||||
/// If you wish to remove a client event handler, call the `off(id:)` with the UUID received from its `on` call.
|
||||
///
|
||||
/// - parameter clientEvent: The event to remove handlers for.
|
||||
open func off(clientEvent event: SocketClientEvent) {
|
||||
off(event.rawValue)
|
||||
}
|
||||
|
||||
/// Removes handler(s) based on an event name.
|
||||
///
|
||||
/// If you wish to remove a specific event, call the `off(id:)` with the UUID received from its `on` call.
|
||||
///
|
||||
/// - parameter event: The event to remove handlers for.
|
||||
open func off(_ event: String) {
|
||||
DefaultSocketLogger.Logger.log("Removing handler for event: \(event)", type: logType)
|
||||
|
||||
handlers = handlers.filter({ $0.event != event })
|
||||
}
|
||||
|
||||
/// Removes a handler with the specified UUID gotten from an `on` or `once`
|
||||
///
|
||||
/// If you want to remove all events for an event, call the off `off(_:)` method with the event name.
|
||||
///
|
||||
/// - parameter id: The UUID of the handler you wish to remove.
|
||||
open func off(id: UUID) {
|
||||
DefaultSocketLogger.Logger.log("Removing handler with id: \(id)", type: logType)
|
||||
|
||||
handlers = handlers.filter({ $0.id != id })
|
||||
}
|
||||
|
||||
/// Adds a handler for an event.
|
||||
///
|
||||
/// - parameter event: The event name for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
@discardableResult
|
||||
open func on(_ event: String, callback: @escaping NormalCallback) -> UUID {
|
||||
DefaultSocketLogger.Logger.log("Adding handler for event: \(event)", type: logType)
|
||||
|
||||
let handler = SocketEventHandler(event: event, id: UUID(), callback: callback)
|
||||
handlers.append(handler)
|
||||
|
||||
return handler.id
|
||||
}
|
||||
|
||||
/// Adds a handler for a client event.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .connect) {data, ack in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
@discardableResult
|
||||
open func on(clientEvent event: SocketClientEvent, callback: @escaping NormalCallback) -> UUID {
|
||||
return on(event.rawValue, callback: callback)
|
||||
}
|
||||
|
||||
/// Adds a single-use handler for a client event.
|
||||
///
|
||||
/// - parameter clientEvent: The event for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
@discardableResult
|
||||
open func once(clientEvent event: SocketClientEvent, callback: @escaping NormalCallback) -> UUID {
|
||||
return once(event.rawValue, callback: callback)
|
||||
}
|
||||
|
||||
/// Adds a single-use handler for an event.
|
||||
///
|
||||
/// - parameter event: The event name for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
@discardableResult
|
||||
open func once(_ event: String, callback: @escaping NormalCallback) -> UUID {
|
||||
DefaultSocketLogger.Logger.log("Adding once handler for event: \(event)", type: logType)
|
||||
|
||||
let id = UUID()
|
||||
|
||||
let handler = SocketEventHandler(event: event, id: id) {[weak self] data, ack in
|
||||
guard let this = self else { return }
|
||||
this.off(id: id)
|
||||
callback(data, ack)
|
||||
}
|
||||
|
||||
handlers.append(handler)
|
||||
|
||||
return handler.id
|
||||
}
|
||||
|
||||
/// Adds a handler that will be called on every event.
|
||||
///
|
||||
/// - parameter handler: The callback that will execute whenever an event is received.
|
||||
open func onAny(_ handler: @escaping (SocketAnyEvent) -> ()) {
|
||||
anyHandler = handler
|
||||
}
|
||||
|
||||
/// Tries to reconnect to the server.
|
||||
@available(*, unavailable, message: "Call the manager's reconnect method")
|
||||
open func reconnect() { }
|
||||
|
||||
/// Removes all handlers.
|
||||
///
|
||||
/// Can be used after disconnecting to break any potential remaining retain cycles.
|
||||
open func removeAllHandlers() {
|
||||
handlers.removeAll(keepingCapacity: false)
|
||||
}
|
||||
|
||||
/// Puts the socket back into the connecting state.
|
||||
/// Called when the manager detects a broken connection, or when a manual reconnect is triggered.
|
||||
///
|
||||
/// - parameter reason: The reason this socket is reconnecting.
|
||||
open func setReconnecting(reason: String) {
|
||||
status = .connecting
|
||||
|
||||
handleClientEvent(.reconnect, data: [reason])
|
||||
}
|
||||
|
||||
// Test properties
|
||||
|
||||
var testHandlers: [SocketEventHandler] {
|
||||
return handlers
|
||||
}
|
||||
|
||||
func setTestable() {
|
||||
status = .connected
|
||||
}
|
||||
|
||||
func setTestStatus(_ status: SocketIOStatus) {
|
||||
self.status = status
|
||||
}
|
||||
|
||||
func emitTest(event: String, _ data: Any...) {
|
||||
emit([event] + data)
|
||||
}
|
||||
}
|
||||
+9
@@ -125,5 +125,14 @@ public struct SocketIOClientConfiguration : ExpressibleByArrayLiteral, Collectio
|
||||
|
||||
backingArray.append(element)
|
||||
}
|
||||
}
|
||||
|
||||
/// Declares that a type can set configs from a `SocketIOClientConfiguration`.
|
||||
public protocol ConfigSettable {
|
||||
// MARK: Methods
|
||||
|
||||
/// Called when an `ConfigSettable` should set/update its configs from a given configuration.
|
||||
///
|
||||
/// - parameter config: The `SocketIOClientConfiguration` that should be used to set/update configs.
|
||||
mutating func setConfigs(_ config: SocketIOClientConfiguration)
|
||||
}
|
||||
+55
-25
@@ -23,6 +23,16 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import Starscream
|
||||
|
||||
/// The socket.io version being used.
|
||||
public enum SocketIOVersion: Int {
|
||||
/// socket.io 2, engine.io 3
|
||||
case two = 2
|
||||
|
||||
/// socket.io 3, engine.io 4
|
||||
case three = 3
|
||||
}
|
||||
|
||||
protocol ClientOption : CustomStringConvertible, Equatable {
|
||||
func getSocketIOOptionValue() -> Any
|
||||
@@ -30,16 +40,15 @@ protocol ClientOption : CustomStringConvertible, Equatable {
|
||||
|
||||
/// The options for a client.
|
||||
public enum SocketIOClientOption : ClientOption {
|
||||
/// If given, the WebSocket transport will attempt to use compression.
|
||||
case compress
|
||||
|
||||
/// A dictionary of GET parameters that will be included in the connect url.
|
||||
case connectParams([String: Any])
|
||||
|
||||
/// An array of cookies that will be sent during the initial connection.
|
||||
case cookies([HTTPCookie])
|
||||
|
||||
/// Deprecated
|
||||
@available(*, deprecated, message: "No longer needed in socket.io 2.0+")
|
||||
case doubleEncodeUTF8(Bool)
|
||||
|
||||
/// Any extra HTTP headers that should be sent during the initial connection.
|
||||
case extraHeaders([String: String])
|
||||
|
||||
@@ -53,8 +62,13 @@ public enum SocketIOClientOption : ClientOption {
|
||||
/// If passed `true`, the only transport that will be used will be WebSockets.
|
||||
case forceWebsockets(Bool)
|
||||
|
||||
/// If passed `true`, the WebSocket stream will be configured with the enableSOCKSProxy `true`.
|
||||
case enableSOCKSProxy(Bool)
|
||||
|
||||
/// The queue that all interaction with the client should occur on. This is the queue that event handlers are
|
||||
/// called on.
|
||||
///
|
||||
/// **This should be a serial queue! Concurrent queues are not supported and might cause crashes and races**.
|
||||
case handleQueue(DispatchQueue)
|
||||
|
||||
/// If passed `true`, the client will log debug information. This should be turned off in production code.
|
||||
@@ -63,10 +77,6 @@ public enum SocketIOClientOption : ClientOption {
|
||||
/// Used to pass in a custom logger.
|
||||
case logger(SocketLogger)
|
||||
|
||||
/// The namespace that this client should connect to. Can be changed during use using the `joinNamespace`
|
||||
/// and `leaveNamespace` methods on `SocketIOClient`.
|
||||
case nsp(String)
|
||||
|
||||
/// A custom path to socket.io. Only use this if the socket.io server is configured to look for this path.
|
||||
case path(String)
|
||||
|
||||
@@ -77,14 +87,20 @@ public enum SocketIOClientOption : ClientOption {
|
||||
/// The number of times to try and reconnect before giving up. Pass `-1` to [never give up](https://www.youtube.com/watch?v=dQw4w9WgXcQ).
|
||||
case reconnectAttempts(Int)
|
||||
|
||||
/// The number of seconds to wait before reconnect attempts.
|
||||
/// The minimum number of seconds to wait before reconnect attempts.
|
||||
case reconnectWait(Int)
|
||||
|
||||
/// The maximum number of seconds to wait before reconnect attempts.
|
||||
case reconnectWaitMax(Int)
|
||||
|
||||
/// The randomization factor for calculating reconnect jitter.
|
||||
case randomizationFactor(Double)
|
||||
|
||||
/// Set `true` if your server is using secure transports.
|
||||
case secure(Bool)
|
||||
|
||||
/// Allows you to set which certs are valid. Useful for SSL pinning.
|
||||
case security(SSLSecurity)
|
||||
case security(CertificatePinning)
|
||||
|
||||
/// If you're using a self-signed set. Only use for development.
|
||||
case selfSigned(Bool)
|
||||
@@ -92,9 +108,11 @@ public enum SocketIOClientOption : ClientOption {
|
||||
/// Sets an NSURLSessionDelegate for the underlying engine. Useful if you need to handle self-signed certs.
|
||||
case sessionDelegate(URLSessionDelegate)
|
||||
|
||||
/// If passed `true`, the WebSocket transport will try and use voip logic to keep network connections open in
|
||||
/// the background. **This option is experimental as socket.io shouldn't be used for background communication.**
|
||||
case voipEnabled(Bool)
|
||||
/// If passed `false`, the WebSocket stream will be configured with the useCustomEngine `false`.
|
||||
case useCustomEngine(Bool)
|
||||
|
||||
/// The version of socket.io being used. This should match the server version. Default is 3.
|
||||
case version(SocketIOVersion)
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
@@ -103,12 +121,12 @@ public enum SocketIOClientOption : ClientOption {
|
||||
let description: String
|
||||
|
||||
switch self {
|
||||
case .compress:
|
||||
description = "compress"
|
||||
case .connectParams:
|
||||
description = "connectParams"
|
||||
case .cookies:
|
||||
description = "cookies"
|
||||
case .doubleEncodeUTF8:
|
||||
description = "doubleEncodeUTF8"
|
||||
case .extraHeaders:
|
||||
description = "extraHeaders"
|
||||
case .forceNew:
|
||||
@@ -123,8 +141,6 @@ public enum SocketIOClientOption : ClientOption {
|
||||
description = "log"
|
||||
case .logger:
|
||||
description = "logger"
|
||||
case .nsp:
|
||||
description = "nsp"
|
||||
case .path:
|
||||
description = "path"
|
||||
case .reconnects:
|
||||
@@ -133,6 +149,10 @@ public enum SocketIOClientOption : ClientOption {
|
||||
description = "reconnectAttempts"
|
||||
case .reconnectWait:
|
||||
description = "reconnectWait"
|
||||
case .reconnectWaitMax:
|
||||
description = "reconnectWaitMax"
|
||||
case .randomizationFactor:
|
||||
description = "randomizationFactor"
|
||||
case .secure:
|
||||
description = "secure"
|
||||
case .selfSigned:
|
||||
@@ -141,8 +161,12 @@ public enum SocketIOClientOption : ClientOption {
|
||||
description = "security"
|
||||
case .sessionDelegate:
|
||||
description = "sessionDelegate"
|
||||
case .voipEnabled:
|
||||
description = "voipEnabled"
|
||||
case .enableSOCKSProxy:
|
||||
description = "enableSOCKSProxy"
|
||||
case .useCustomEngine:
|
||||
description = "customEngine"
|
||||
case .version:
|
||||
description = "version"
|
||||
}
|
||||
|
||||
return description
|
||||
@@ -152,12 +176,12 @@ public enum SocketIOClientOption : ClientOption {
|
||||
let value: Any
|
||||
|
||||
switch self {
|
||||
case .compress:
|
||||
value = true
|
||||
case let .connectParams(params):
|
||||
value = params
|
||||
case let .cookies(cookies):
|
||||
value = cookies
|
||||
case let .doubleEncodeUTF8(encode):
|
||||
value = encode
|
||||
case let .extraHeaders(headers):
|
||||
value = headers
|
||||
case let .forceNew(force):
|
||||
@@ -172,8 +196,6 @@ public enum SocketIOClientOption : ClientOption {
|
||||
value = log
|
||||
case let .logger(logger):
|
||||
value = logger
|
||||
case let .nsp(nsp):
|
||||
value = nsp
|
||||
case let .path(path):
|
||||
value = path
|
||||
case let .reconnects(reconnects):
|
||||
@@ -182,6 +204,10 @@ public enum SocketIOClientOption : ClientOption {
|
||||
value = attempts
|
||||
case let .reconnectWait(wait):
|
||||
value = wait
|
||||
case let .reconnectWaitMax(wait):
|
||||
value = wait
|
||||
case let .randomizationFactor(factor):
|
||||
value = factor
|
||||
case let .secure(secure):
|
||||
value = secure
|
||||
case let .security(security):
|
||||
@@ -190,8 +216,12 @@ public enum SocketIOClientOption : ClientOption {
|
||||
value = signed
|
||||
case let .sessionDelegate(delegate):
|
||||
value = delegate
|
||||
case let .voipEnabled(enabled):
|
||||
value = enabled
|
||||
case let .enableSOCKSProxy(enable):
|
||||
value = enable
|
||||
case let .useCustomEngine(enable):
|
||||
value = enable
|
||||
case let.version(versionNum):
|
||||
value = versionNum
|
||||
}
|
||||
|
||||
return value
|
||||
@@ -0,0 +1,392 @@
|
||||
//
|
||||
// SocketIOClientSpec.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 1/3/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.
|
||||
|
||||
import Dispatch
|
||||
import Foundation
|
||||
|
||||
/// Defines the interface for a SocketIOClient.
|
||||
public protocol SocketIOClientSpec : AnyObject {
|
||||
// MARK: Properties
|
||||
|
||||
/// A handler that will be called on any event.
|
||||
var anyHandler: ((SocketAnyEvent) -> ())? { get }
|
||||
|
||||
/// The array of handlers for this socket.
|
||||
var handlers: [SocketEventHandler] { get }
|
||||
|
||||
/// The manager for this socket.
|
||||
var manager: SocketManagerSpec? { get }
|
||||
|
||||
/// The namespace that this socket is currently connected to.
|
||||
///
|
||||
/// **Must** start with a `/`.
|
||||
var nsp: String { get }
|
||||
|
||||
/// A view into this socket where emits do not check for binary data.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.rawEmitView.emit("myEvent", myObject)
|
||||
/// ```
|
||||
///
|
||||
/// **NOTE**: It is not safe to hold on to this view beyond the life of the socket.
|
||||
var rawEmitView: SocketRawView { get }
|
||||
|
||||
/// The id of this socket.io connect. This is different from the sid of the engine.io connection.
|
||||
var sid: String? { get }
|
||||
|
||||
/// The status of this client.
|
||||
var status: SocketIOStatus { get }
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
/// Connect to the server. The same as calling `connect(timeoutAfter:withHandler:)` with a timeout of 0.
|
||||
///
|
||||
/// Only call after adding your event listeners, unless you know what you're doing.
|
||||
///
|
||||
/// - parameter payload: An optional payload sent on connect
|
||||
func connect(withPayload payload: [String: Any]?)
|
||||
|
||||
/// Connect to the server. If we aren't connected after `timeoutAfter` seconds, then `withHandler` is called.
|
||||
///
|
||||
/// Only call after adding your event listeners, unless you know what you're doing.
|
||||
///
|
||||
/// - parameter withPayload: An optional payload sent on connect
|
||||
/// - parameter timeoutAfter: The number of seconds after which if we are not connected we assume the connection
|
||||
/// has failed. Pass 0 to never timeout.
|
||||
/// - parameter handler: The handler to call when the client fails to connect.
|
||||
func connect(withPayload payload: [String: Any]?, timeoutAfter: Double, withHandler handler: (() -> ())?)
|
||||
|
||||
/// Called when the client connects to a namespace. If the client was created with a namespace upfront,
|
||||
/// then this is only called when the client connects to that namespace.
|
||||
///
|
||||
/// - parameter toNamespace: The namespace that was connected to.
|
||||
func didConnect(toNamespace namespace: String, payload: [String: Any]?)
|
||||
|
||||
/// Called when the client has disconnected from socket.io.
|
||||
///
|
||||
/// - parameter reason: The reason for the disconnection.
|
||||
func didDisconnect(reason: String)
|
||||
|
||||
/// Called when the client encounters an error.
|
||||
///
|
||||
/// - parameter reason: The reason for the disconnection.
|
||||
func didError(reason: String)
|
||||
|
||||
/// Disconnects the socket.
|
||||
func disconnect()
|
||||
|
||||
/// Send an event to the server, with optional data items and optional write completion handler.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - parameter completion: Callback called on transport write completion.
|
||||
func emit(_ event: String, _ items: SocketData..., completion: (() -> ())?)
|
||||
|
||||
/// Send an event to the server, with optional data items and optional write completion handler.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - parameter completion: Callback called on transport write completion.
|
||||
func emit(_ event: String, with items: [SocketData], completion: (() -> ())?)
|
||||
|
||||
/// Call when you wish to tell the server that you've received the event for `ack`.
|
||||
///
|
||||
/// - parameter ack: The ack number.
|
||||
/// - parameter with: The data for this ack.
|
||||
func emitAck(_ ack: Int, with items: [Any])
|
||||
|
||||
/// Sends a message to the server, requesting an ack.
|
||||
///
|
||||
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
/// Check that your server's api will ack the event being sent.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
|
||||
func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback
|
||||
|
||||
/// Sends a message to the server, requesting an ack.
|
||||
///
|
||||
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
/// Check that your server's api will ack the event being sent.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
|
||||
func emitWithAck(_ event: String, with items: [SocketData]) -> OnAckCallback
|
||||
|
||||
/// Called when socket.io has acked one of our emits. Causes the corresponding ack callback to be called.
|
||||
///
|
||||
/// - parameter ack: The number for this ack.
|
||||
/// - parameter data: The data sent back with this ack.
|
||||
func handleAck(_ ack: Int, data: [Any])
|
||||
|
||||
/// Called on socket.io specific events.
|
||||
///
|
||||
/// - parameter event: The `SocketClientEvent`.
|
||||
/// - parameter data: The data for this event.
|
||||
func handleClientEvent(_ event: SocketClientEvent, data: [Any])
|
||||
|
||||
/// Called when we get an event from socket.io.
|
||||
///
|
||||
/// - parameter event: The name of the event.
|
||||
/// - parameter data: The data that was sent with this event.
|
||||
/// - parameter isInternalMessage: Whether this event was sent internally. If `true` it is always sent to handlers.
|
||||
/// - parameter ack: If > 0 then this event expects to get an ack back from the client.
|
||||
func handleEvent(_ event: String, data: [Any], isInternalMessage: Bool, withAck ack: Int)
|
||||
|
||||
/// Causes a client to handle a socket.io packet. The namespace for the packet must match the namespace of the
|
||||
/// socket.
|
||||
///
|
||||
/// - parameter packet: The packet to handle.
|
||||
func handlePacket(_ packet: SocketPacket)
|
||||
|
||||
/// Call when you wish to leave a namespace and disconnect this socket.
|
||||
func leaveNamespace()
|
||||
|
||||
/// Joins `nsp`. You shouldn't need to call this directly, instead call `connect`.
|
||||
///
|
||||
/// - Parameter withPayload: The payload to connect when joining this namespace
|
||||
func joinNamespace(withPayload payload: [String: Any]?)
|
||||
|
||||
/// Removes handler(s) for a client event.
|
||||
///
|
||||
/// If you wish to remove a client event handler, call the `off(id:)` with the UUID received from its `on` call.
|
||||
///
|
||||
/// - parameter clientEvent: The event to remove handlers for.
|
||||
func off(clientEvent event: SocketClientEvent)
|
||||
|
||||
/// Removes handler(s) based on an event name.
|
||||
///
|
||||
/// If you wish to remove a specific event, call the `off(id:)` with the UUID received from its `on` call.
|
||||
///
|
||||
/// - parameter event: The event to remove handlers for.
|
||||
func off(_ event: String)
|
||||
|
||||
/// Removes a handler with the specified UUID gotten from an `on` or `once`
|
||||
///
|
||||
/// If you want to remove all events for an event, call the off `off(_:)` method with the event name.
|
||||
///
|
||||
/// - parameter id: The UUID of the handler you wish to remove.
|
||||
func off(id: UUID)
|
||||
|
||||
/// Adds a handler for an event.
|
||||
///
|
||||
/// - parameter event: The event name for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
func on(_ event: String, callback: @escaping NormalCallback) -> UUID
|
||||
|
||||
/// Adds a handler for a client event.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .connect) {data, ack in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
func on(clientEvent event: SocketClientEvent, callback: @escaping NormalCallback) -> UUID
|
||||
|
||||
/// Adds a single-use handler for a client event.
|
||||
///
|
||||
/// - parameter clientEvent: The event for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
func once(clientEvent event: SocketClientEvent, callback: @escaping NormalCallback) -> UUID
|
||||
|
||||
/// Adds a single-use handler for an event.
|
||||
///
|
||||
/// - parameter event: The event name for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
func once(_ event: String, callback: @escaping NormalCallback) -> UUID
|
||||
|
||||
/// Adds a handler that will be called on every event.
|
||||
///
|
||||
/// - parameter handler: The callback that will execute whenever an event is received.
|
||||
func onAny(_ handler: @escaping (SocketAnyEvent) -> ())
|
||||
|
||||
/// Removes all handlers.
|
||||
///
|
||||
/// Can be used after disconnecting to break any potential remaining retain cycles.
|
||||
func removeAllHandlers()
|
||||
|
||||
/// Puts the socket back into the connecting state.
|
||||
/// Called when the manager detects a broken connection, or when a manual reconnect is triggered.
|
||||
///
|
||||
/// parameter reason: The reason this socket is going reconnecting.
|
||||
func setReconnecting(reason: String)
|
||||
}
|
||||
|
||||
public extension SocketIOClientSpec {
|
||||
/// Default implementation.
|
||||
func didError(reason: String) {
|
||||
DefaultSocketLogger.Logger.error("\(reason)", type: "SocketIOClient")
|
||||
|
||||
handleClientEvent(.error, data: [reason])
|
||||
}
|
||||
}
|
||||
|
||||
/// The set of events that are generated by the client.
|
||||
public enum SocketClientEvent : String {
|
||||
// MARK: Cases
|
||||
|
||||
/// Emitted when the client connects. This is also called on a successful reconnection. A connect event gets one
|
||||
/// data item: the namespace that was connected to.
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .connect) {data, ack in
|
||||
/// guard let nsp = data[0] as? String else { return }
|
||||
/// // Some logic using the nsp
|
||||
/// }
|
||||
/// ```
|
||||
case connect
|
||||
|
||||
/// Emitted when the socket has disconnected and will not attempt to try to reconnect.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .disconnect) {data, ack in
|
||||
/// // Some cleanup logic
|
||||
/// }
|
||||
/// ```
|
||||
case disconnect
|
||||
|
||||
/// Emitted when an error occurs.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .error) {data, ack in
|
||||
/// // Some logging
|
||||
/// }
|
||||
/// ```
|
||||
case error
|
||||
|
||||
/// Emitted whenever the engine sends a ping.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .ping) {_, _ in
|
||||
/// // Maybe keep track of latency?
|
||||
/// }
|
||||
/// ```
|
||||
case ping
|
||||
|
||||
/// Emitted whenever the engine gets a pong.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .pong) {_, _ in
|
||||
/// // Maybe keep track of latency?
|
||||
/// }
|
||||
/// ```
|
||||
case pong
|
||||
|
||||
/// Emitted when the client begins the reconnection process.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .reconnect) {data, ack in
|
||||
/// // Some reconnect event logic
|
||||
/// }
|
||||
/// ```
|
||||
case reconnect
|
||||
|
||||
/// Emitted each time the client tries to reconnect to the server.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .reconnectAttempt) {data, ack in
|
||||
/// // Some reconnect attempt logging
|
||||
/// }
|
||||
/// ```
|
||||
case reconnectAttempt
|
||||
|
||||
/// Emitted every time there is a change in the client's status.
|
||||
///
|
||||
/// The payload for data is [SocketIOClientStatus, Int]. Where the second item is the raw value. Use the second one
|
||||
/// if you are working in Objective-C.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .statusChange) {data, ack in
|
||||
/// // Some status changing logging
|
||||
/// }
|
||||
/// ```
|
||||
case statusChange
|
||||
|
||||
/// Emitted when when upgrading the http connection to a websocket connection.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .websocketUpgrade) {data, ack in
|
||||
/// let headers = (data as [Any])[0]
|
||||
/// // Some header logic
|
||||
/// }
|
||||
/// ```
|
||||
case websocketUpgrade
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// SocketIOClientStatus.swift
|
||||
// SocketIOStatus.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 8/14/15.
|
||||
@@ -24,17 +24,36 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents the state of the client.
|
||||
@objc public enum SocketIOClientStatus : Int {
|
||||
/// The client has never been connected. Or the client has been reset.
|
||||
/// Represents state of a manager or client.
|
||||
@objc
|
||||
public enum SocketIOStatus : Int, CustomStringConvertible {
|
||||
// MARK: Cases
|
||||
|
||||
/// The client/manager has never been connected. Or the client has been reset.
|
||||
case notConnected
|
||||
|
||||
/// The client was once connected, but not anymore.
|
||||
/// The client/manager was once connected, but not anymore.
|
||||
case disconnected
|
||||
|
||||
/// The client is in the process of connecting.
|
||||
/// The client/manager is in the process of connecting.
|
||||
case connecting
|
||||
|
||||
/// The client is currently connected.
|
||||
/// The client/manager is currently connected.
|
||||
case connected
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// - returns: True if this client/manager is connected/connecting to a server.
|
||||
public var active: Bool {
|
||||
return self == .connected || self == .connecting
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
switch self {
|
||||
case .connected: return "connected"
|
||||
case .connecting: return "connecting"
|
||||
case .disconnected: return "disconnected"
|
||||
case .notConnected: return "notConnected"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
//
|
||||
// SocketRawView.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 3/30/18.
|
||||
//
|
||||
// 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.
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.rawEmitView.emit("myEvent", myObject)
|
||||
/// ```
|
||||
public final class SocketRawView : NSObject {
|
||||
private unowned let socket: SocketIOClient
|
||||
|
||||
init(socket: SocketIOClient) {
|
||||
self.socket = socket
|
||||
}
|
||||
|
||||
/// Send an event to the server, with optional data items.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
public func emit(_ event: String, _ items: SocketData...) {
|
||||
do {
|
||||
try emit(event, with: items.map({ try $0.socketRepresentation() }))
|
||||
} catch {
|
||||
DefaultSocketLogger.Logger.error("Error creating socketRepresentation for emit: \(event), \(items)",
|
||||
type: "SocketIOClient")
|
||||
|
||||
socket.handleClientEvent(.error, data: [event, items, error])
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as emit, but meant for Objective-C
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. Send an empty array to send no data.
|
||||
@objc
|
||||
public func emit(_ event: String, with items: [Any]) {
|
||||
socket.emit([event] + items, binary: false)
|
||||
}
|
||||
|
||||
/// Sends a message to the server, requesting an ack.
|
||||
///
|
||||
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
/// Check that your server's api will ack the event being sent.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
|
||||
public func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback {
|
||||
do {
|
||||
return emitWithAck(event, with: try items.map({ try $0.socketRepresentation() }))
|
||||
} catch {
|
||||
DefaultSocketLogger.Logger.error("Error creating socketRepresentation for emit: \(event), \(items)",
|
||||
type: "SocketIOClient")
|
||||
|
||||
socket.handleClientEvent(.error, data: [event, items, error])
|
||||
|
||||
return OnAckCallback(ackNumber: -1, items: [], socket: socket)
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as emitWithAck, but for Objective-C
|
||||
///
|
||||
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
/// Check that your server's api will ack the event being sent.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.emitWithAck("myEvent", with: [1]).timingOut(after: 1) {data in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. Use `[]` to send nothing.
|
||||
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
|
||||
@objc
|
||||
public func emitWithAck(_ event: String, with items: [Any]) -> OnAckCallback {
|
||||
return socket.createOnAck([event] + items, binary: false)
|
||||
}
|
||||
}
|
||||
|
||||
/// Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.
|
||||
///
|
||||
/// Usage:
|
||||
///
|
||||
/// ```swift
|
||||
/// ack.rawEmitView.with(myObject)
|
||||
/// ```
|
||||
public final class SocketRawAckView : NSObject {
|
||||
private unowned let socket: SocketIOClient
|
||||
private let ackNum: Int
|
||||
|
||||
init(socket: SocketIOClient, ackNum: Int) {
|
||||
self.socket = socket
|
||||
self.ackNum = ackNum
|
||||
}
|
||||
|
||||
/// Call to ack receiving this event.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[ackNum, items, theError]`
|
||||
///
|
||||
/// - parameter items: A variable number of items to send when acking.
|
||||
public func with(_ items: SocketData...) {
|
||||
guard ackNum != -1 else { return }
|
||||
|
||||
do {
|
||||
socket.emit(try items.map({ try $0.socketRepresentation() }), ack: ackNum, binary: false, isAck: true)
|
||||
} catch {
|
||||
socket.handleClientEvent(.error, data: [ackNum, items, error])
|
||||
}
|
||||
}
|
||||
|
||||
/// Call to ack receiving this event.
|
||||
///
|
||||
/// - parameter items: An array of items to send when acking. Use `[]` to send nothing.
|
||||
@objc
|
||||
public func with(_ items: [Any]) {
|
||||
guard ackNum != -1 else { return }
|
||||
|
||||
socket.emit(items, ack: ackNum, binary: false, isAck: true)
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,18 @@
|
||||
|
||||
import Dispatch
|
||||
import Foundation
|
||||
import Starscream
|
||||
|
||||
/// The class that handles the engine.io protocol and transports.
|
||||
/// See `SocketEnginePollable` and `SocketEngineWebsocket` for transport specific methods.
|
||||
public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket {
|
||||
open class SocketEngine: NSObject, WebSocketDelegate, URLSessionDelegate,
|
||||
SocketEnginePollable, SocketEngineWebsocket, ConfigSettable {
|
||||
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
private static let logType = "SocketEngine"
|
||||
|
||||
/// The queue that all engine actions take place on.
|
||||
public let engineQueue = DispatchQueue(label: "com.socketio.engineHandleQueue")
|
||||
|
||||
@@ -40,10 +46,13 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
}
|
||||
}
|
||||
|
||||
/// A dictionary of extra http headers that will be set during connection.
|
||||
public var extraHeaders: [String: String]?
|
||||
|
||||
/// A queue of engine.io messages waiting for POSTing
|
||||
///
|
||||
/// **You should not touch this directly**
|
||||
public var postWait = [String]()
|
||||
public var postWait = [Post]()
|
||||
|
||||
/// `true` if there is an outstanding poll. Trying to poll before the first is done will cause socket.io to
|
||||
/// disconnect us.
|
||||
@@ -60,15 +69,15 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
/// `true` if this engine is closed.
|
||||
public private(set) var closed = false
|
||||
|
||||
/// If `true` the engine will attempt to use WebSocket compression.
|
||||
public private(set) var compress = false
|
||||
|
||||
/// `true` if this engine is connected. Connected means that the initial poll connect has succeeded.
|
||||
public private(set) var connected = false
|
||||
|
||||
/// An array of HTTPCookies that are sent during the connection.
|
||||
public private(set) var cookies: [HTTPCookie]?
|
||||
|
||||
/// A dictionary of extra http headers that will be set during connection.
|
||||
public private(set) var extraHeaders: [String: String]?
|
||||
|
||||
/// When `true`, the engine is in the process of switching to WebSockets.
|
||||
///
|
||||
/// **Do not touch this directly**
|
||||
@@ -104,24 +113,37 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
/// The url for WebSockets.
|
||||
public private(set) var urlWebSocket = URL(string: "http://localhost/")!
|
||||
|
||||
/// When `false`, the WebSocket `stream` will be configured with the useCustomEngine `false`.
|
||||
public private(set) var useCustomEngine = true
|
||||
|
||||
/// The version of engine.io being used. Default is three.
|
||||
public private(set) var version: SocketIOVersion = .three
|
||||
|
||||
/// If `true`, then the engine is currently in WebSockets mode.
|
||||
@available(*, deprecated, message: "No longer needed, if we're not polling, then we must be doing websockets")
|
||||
public private(set) var websocket = false
|
||||
|
||||
/// When `true`, the WebSocket `stream` will be configured with the enableSOCKSProxy `true`.
|
||||
public private(set) var enableSOCKSProxy = false
|
||||
|
||||
/// The WebSocket for this engine.
|
||||
public private(set) var ws: WebSocket?
|
||||
|
||||
/// Whether or not the WebSocket is currently connected.
|
||||
public private(set) var wsConnected = false
|
||||
|
||||
/// The client for this engine.
|
||||
public weak var client: SocketEngineClient?
|
||||
|
||||
private weak var sessionDelegate: URLSessionDelegate?
|
||||
|
||||
private let logType = "SocketEngine"
|
||||
private let url: URL
|
||||
|
||||
private var pingInterval: Double?
|
||||
private var pingTimeout = 0.0 {
|
||||
private var lastCommunication: Date?
|
||||
private var pingInterval: Int?
|
||||
private var pingTimeout = 0 {
|
||||
didSet {
|
||||
pongsMissedMax = Int(pingTimeout / (pingInterval ?? 25))
|
||||
pongsMissedMax = Int(pingTimeout / (pingInterval ?? 25000))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,9 +151,8 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
private var pongsMissedMax = 0
|
||||
private var probeWait = ProbeWaitQueue()
|
||||
private var secure = false
|
||||
private var security: SSLSecurity?
|
||||
private var certPinner: CertificatePinning?
|
||||
private var selfSigned = false
|
||||
private var voipEnabled = false
|
||||
|
||||
// MARK: Initializers
|
||||
|
||||
@@ -143,41 +164,11 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
public init(client: SocketEngineClient, url: URL, config: SocketIOClientConfiguration) {
|
||||
self.client = client
|
||||
self.url = url
|
||||
for option in config {
|
||||
switch option {
|
||||
case let .connectParams(params):
|
||||
connectParams = params
|
||||
case let .cookies(cookies):
|
||||
self.cookies = cookies
|
||||
case let .extraHeaders(headers):
|
||||
extraHeaders = headers
|
||||
case let .sessionDelegate(delegate):
|
||||
sessionDelegate = delegate
|
||||
case let .forcePolling(force):
|
||||
forcePolling = force
|
||||
case let .forceWebsockets(force):
|
||||
forceWebsockets = force
|
||||
case let .path(path):
|
||||
socketPath = path
|
||||
|
||||
if !socketPath.hasSuffix("/") {
|
||||
socketPath += "/"
|
||||
}
|
||||
case let .voipEnabled(enable):
|
||||
voipEnabled = enable
|
||||
case let .secure(secure):
|
||||
self.secure = secure
|
||||
case let .selfSigned(selfSigned):
|
||||
self.selfSigned = selfSigned
|
||||
case let .security(security):
|
||||
self.security = security
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
super.init()
|
||||
|
||||
setConfigs(config)
|
||||
|
||||
sessionDelegate = sessionDelegate ?? self
|
||||
|
||||
(urlPolling, urlWebSocket) = createURLs()
|
||||
@@ -188,12 +179,13 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
/// - parameter client: The client for this engine.
|
||||
/// - parameter url: The url for this engine.
|
||||
/// - parameter options: The options for this engine.
|
||||
public convenience init(client: SocketEngineClient, url: URL, options: NSDictionary?) {
|
||||
public required convenience init(client: SocketEngineClient, url: URL, options: [String: Any]?) {
|
||||
self.init(client: client, url: url, config: options?.toSocketConfiguration() ?? [])
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
deinit {
|
||||
DefaultSocketLogger.Logger.log("Engine is being released", type: logType)
|
||||
DefaultSocketLogger.Logger.log("Engine is being released", type: SocketEngine.logType)
|
||||
closed = true
|
||||
stopPolling()
|
||||
}
|
||||
@@ -202,7 +194,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
|
||||
private func checkAndHandleEngineError(_ msg: String) {
|
||||
do {
|
||||
let dict = try msg.toNSDictionary()
|
||||
let dict = try msg.toDictionary()
|
||||
guard let error = dict["message"] as? String else { return }
|
||||
|
||||
/*
|
||||
@@ -218,8 +210,9 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
}
|
||||
|
||||
private func handleBase64(message: String) {
|
||||
let offset = version.rawValue >= 3 ? 1 : 2
|
||||
// binary in base64 string
|
||||
let noPrefix = message[message.index(message.startIndex, offsetBy: 2)..<message.endIndex]
|
||||
let noPrefix = String(message[message.index(message.startIndex, offsetBy: offset)..<message.endIndex])
|
||||
|
||||
if let data = Data(base64Encoded: noPrefix, options: .ignoreUnknownCharacters) {
|
||||
client?.parseEngineBinaryData(data)
|
||||
@@ -238,7 +231,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
}
|
||||
|
||||
/// Starts the connection to the server.
|
||||
public func connect() {
|
||||
open func connect() {
|
||||
engineQueue.async {
|
||||
self._connect()
|
||||
}
|
||||
@@ -246,35 +239,25 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
|
||||
private func _connect() {
|
||||
if connected {
|
||||
DefaultSocketLogger.Logger.error("Engine tried opening while connected. Assuming this was a reconnect", type: logType)
|
||||
disconnect(reason: "reconnect")
|
||||
DefaultSocketLogger.Logger.error("Engine tried opening while connected. Assuming this was a reconnect",
|
||||
type: SocketEngine.logType)
|
||||
_disconnect(reason: "reconnect")
|
||||
}
|
||||
|
||||
DefaultSocketLogger.Logger.log("Starting engine. Server: %@", type: logType, args: url)
|
||||
DefaultSocketLogger.Logger.log("Handshaking", type: logType)
|
||||
DefaultSocketLogger.Logger.log("Starting engine. Server: \(url)", type: SocketEngine.logType)
|
||||
DefaultSocketLogger.Logger.log("Handshaking", type: SocketEngine.logType)
|
||||
|
||||
resetEngine()
|
||||
|
||||
if forceWebsockets {
|
||||
polling = false
|
||||
websocket = true
|
||||
createWebsocketAndConnect()
|
||||
createWebSocketAndConnect()
|
||||
return
|
||||
}
|
||||
|
||||
var reqPolling = URLRequest(url: urlPolling, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: 60.0)
|
||||
|
||||
if cookies != nil {
|
||||
let headers = HTTPCookie.requestHeaderFields(with: cookies!)
|
||||
reqPolling.allHTTPHeaderFields = headers
|
||||
}
|
||||
|
||||
if let extraHeaders = extraHeaders {
|
||||
for (headerName, value) in extraHeaders {
|
||||
reqPolling.setValue(value, forHTTPHeaderField: headerName)
|
||||
}
|
||||
}
|
||||
|
||||
addHeaders(to: &reqPolling)
|
||||
doLongPoll(for: reqPolling)
|
||||
}
|
||||
|
||||
@@ -298,9 +281,9 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
urlWebSocket.scheme = "ws"
|
||||
}
|
||||
|
||||
if connectParams != nil {
|
||||
for (key, value) in connectParams! {
|
||||
let keyEsc = key.urlEncode()!
|
||||
if let connectParams = self.connectParams {
|
||||
for (key, value) in connectParams {
|
||||
let keyEsc = key.urlEncode()!
|
||||
let valueEsc = "\(value)".urlEncode()!
|
||||
|
||||
queryString += "&\(keyEsc)=\(valueEsc)"
|
||||
@@ -310,38 +293,35 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
urlWebSocket.percentEncodedQuery = "transport=websocket" + queryString
|
||||
urlPolling.percentEncodedQuery = "transport=polling&b64=1" + queryString
|
||||
|
||||
if !urlWebSocket.percentEncodedQuery!.contains("EIO") {
|
||||
urlWebSocket.percentEncodedQuery = urlWebSocket.percentEncodedQuery! + engineIOParam
|
||||
}
|
||||
|
||||
if !urlPolling.percentEncodedQuery!.contains("EIO") {
|
||||
urlPolling.percentEncodedQuery = urlPolling.percentEncodedQuery! + engineIOParam
|
||||
}
|
||||
|
||||
return (urlPolling.url!, urlWebSocket.url!)
|
||||
}
|
||||
|
||||
private func createWebsocketAndConnect() {
|
||||
ws?.delegate = nil
|
||||
ws = WebSocket(url: urlWebSocketWithSid as URL)
|
||||
private func createWebSocketAndConnect() {
|
||||
var req = URLRequest(url: urlWebSocketWithSid)
|
||||
|
||||
if cookies != nil {
|
||||
let headers = HTTPCookie.requestHeaderFields(with: cookies!)
|
||||
for (key, value) in headers {
|
||||
ws?.headers[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
if extraHeaders != nil {
|
||||
for (headerName, value) in extraHeaders! {
|
||||
ws?.headers[headerName] = value
|
||||
}
|
||||
}
|
||||
addHeaders(
|
||||
to: &req,
|
||||
includingCookies: session?.configuration.httpCookieStorage?.cookies(for: urlPollingWithSid)
|
||||
)
|
||||
|
||||
ws = WebSocket(request: req, certPinner: certPinner, compressionHandler: compress ? WSCompression() : nil, useCustomEngine: useCustomEngine)
|
||||
ws?.callbackQueue = engineQueue
|
||||
ws?.voipEnabled = voipEnabled
|
||||
ws?.delegate = self
|
||||
ws?.disableSSLCertValidation = selfSigned
|
||||
ws?.security = security
|
||||
|
||||
ws?.connect()
|
||||
}
|
||||
|
||||
/// Called when an error happens during execution. Causes a disconnection.
|
||||
public func didError(reason: String) {
|
||||
DefaultSocketLogger.Logger.error("%@", type: logType, args: reason)
|
||||
open func didError(reason: String) {
|
||||
DefaultSocketLogger.Logger.error("\(reason)", type: SocketEngine.logType)
|
||||
client?.engineDidError(reason: reason)
|
||||
disconnect(reason: reason)
|
||||
}
|
||||
@@ -349,33 +329,29 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
/// Disconnects from the server.
|
||||
///
|
||||
/// - parameter reason: The reason for the disconnection. This is communicated up to the client.
|
||||
public func disconnect(reason: String) {
|
||||
open func disconnect(reason: String) {
|
||||
engineQueue.async {
|
||||
self._disconnect(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
private func _disconnect(reason: String) {
|
||||
guard connected else { return closeOutEngine(reason: reason) }
|
||||
guard connected && !closed else { return closeOutEngine(reason: reason) }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Engine is being closed.", type: logType)
|
||||
DefaultSocketLogger.Logger.log("Engine is being closed.", type: SocketEngine.logType)
|
||||
|
||||
if closed {
|
||||
return closeOutEngine(reason: reason)
|
||||
}
|
||||
|
||||
if websocket {
|
||||
sendWebSocketMessage("", withType: .close, withData: [])
|
||||
closeOutEngine(reason: reason)
|
||||
} else {
|
||||
if polling {
|
||||
disconnectPolling(reason: reason)
|
||||
} else {
|
||||
sendWebSocketMessage("", withType: .close, withData: [], completion: nil)
|
||||
closeOutEngine(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
// We need to take special care when we're polling that we send it ASAP
|
||||
// Also make sure we're on the emitQueue since we're touching postWait
|
||||
private func disconnectPolling(reason: String) {
|
||||
postWait.append(String(SocketEnginePacketType.close.rawValue))
|
||||
postWait.append((String(SocketEnginePacketType.close.rawValue), {}))
|
||||
|
||||
doRequest(for: createRequestForPostWithPostWait()) {_, _, _ in }
|
||||
closeOutEngine(reason: reason)
|
||||
@@ -385,43 +361,47 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
/// WebSocket mode.
|
||||
///
|
||||
/// **You shouldn't call this directly**
|
||||
public func doFastUpgrade() {
|
||||
open func doFastUpgrade() {
|
||||
if waitingForPoll {
|
||||
DefaultSocketLogger.Logger.error("Outstanding poll when switched to WebSockets," +
|
||||
"we'll probably disconnect soon. You should report this.", type: logType)
|
||||
"we'll probably disconnect soon. You should report this.", type: SocketEngine.logType)
|
||||
}
|
||||
|
||||
sendWebSocketMessage("", withType: .upgrade, withData: [])
|
||||
websocket = true
|
||||
DefaultSocketLogger.Logger.log("Switching to WebSockets", type: SocketEngine.logType)
|
||||
|
||||
sendWebSocketMessage("", withType: .upgrade, withData: [], completion: nil)
|
||||
polling = false
|
||||
fastUpgrade = false
|
||||
probing = false
|
||||
flushProbeWait()
|
||||
|
||||
// Need to flush postWait to socket since it connected successfully
|
||||
// moved from flushProbeWait() since it is also called on connected failure, and we don't want to try and send
|
||||
// packets through WebSockets when WebSockets has failed!
|
||||
if !postWait.isEmpty {
|
||||
flushWaitingForPostToWebSocket()
|
||||
}
|
||||
}
|
||||
|
||||
private func flushProbeWait() {
|
||||
DefaultSocketLogger.Logger.log("Flushing probe wait", type: logType)
|
||||
DefaultSocketLogger.Logger.log("Flushing probe wait", type: SocketEngine.logType)
|
||||
|
||||
for waiter in probeWait {
|
||||
write(waiter.msg, withType: waiter.type, withData: waiter.data)
|
||||
write(waiter.msg, withType: waiter.type, withData: waiter.data, completion: waiter.completion)
|
||||
}
|
||||
|
||||
probeWait.removeAll(keepingCapacity: false)
|
||||
|
||||
if postWait.count != 0 {
|
||||
flushWaitingForPostToWebSocket()
|
||||
}
|
||||
}
|
||||
|
||||
/// Causes any packets that were waiting for POSTing to be sent through the WebSocket. This happens because when
|
||||
/// the engine is attempting to upgrade to WebSocket it does not do any POSTing.
|
||||
///
|
||||
/// **You shouldn't call this directly**
|
||||
public func flushWaitingForPostToWebSocket() {
|
||||
open func flushWaitingForPostToWebSocket() {
|
||||
guard let ws = self.ws else { return }
|
||||
|
||||
for msg in postWait {
|
||||
ws.write(string: msg)
|
||||
ws.write(string: msg.msg, completion: msg.completion)
|
||||
}
|
||||
|
||||
postWait.removeAll(keepingCapacity: false)
|
||||
@@ -440,7 +420,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
}
|
||||
|
||||
private func handleOpen(openData: String) {
|
||||
guard let json = try? openData.toNSDictionary() else {
|
||||
guard let json = try? openData.toDictionary() else {
|
||||
didError(reason: "Error parsing open packet")
|
||||
|
||||
return
|
||||
@@ -464,16 +444,20 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
upgradeWs = false
|
||||
}
|
||||
|
||||
if let pingInterval = json["pingInterval"] as? Double, let pingTimeout = json["pingTimeout"] as? Double {
|
||||
self.pingInterval = pingInterval / 1000.0
|
||||
self.pingTimeout = pingTimeout / 1000.0
|
||||
if let pingInterval = json["pingInterval"] as? Int, let pingTimeout = json["pingTimeout"] as? Int {
|
||||
self.pingInterval = pingInterval
|
||||
self.pingTimeout = pingTimeout
|
||||
}
|
||||
|
||||
if !forcePolling && !forceWebsockets && upgradeWs {
|
||||
createWebsocketAndConnect()
|
||||
createWebSocketAndConnect()
|
||||
}
|
||||
|
||||
sendPing()
|
||||
if version.rawValue >= 3 {
|
||||
checkPings()
|
||||
} else {
|
||||
sendPing()
|
||||
}
|
||||
|
||||
if !forceWebsockets {
|
||||
doPoll()
|
||||
@@ -487,34 +471,64 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
|
||||
// We should upgrade
|
||||
if message == "3probe" {
|
||||
DefaultSocketLogger.Logger.log("Received probe response, should upgrade to WebSockets",
|
||||
type: SocketEngine.logType)
|
||||
|
||||
upgradeTransport()
|
||||
}
|
||||
|
||||
client?.engineDidReceivePong()
|
||||
}
|
||||
|
||||
private func handlePing(with message: String) {
|
||||
if version.rawValue >= 3 {
|
||||
write("", withType: .pong, withData: [])
|
||||
}
|
||||
|
||||
client?.engineDidReceivePing()
|
||||
}
|
||||
|
||||
private func checkPings() {
|
||||
let pingInterval = self.pingInterval ?? 25_000
|
||||
let deadlineMs = Double(pingInterval + pingTimeout) / 1000
|
||||
let timeoutDeadline = DispatchTime.now() + .milliseconds(pingInterval + pingTimeout)
|
||||
|
||||
engineQueue.asyncAfter(deadline: timeoutDeadline) {[weak self, id = self.sid] in
|
||||
// Make sure not to ping old connections
|
||||
guard let this = self, this.sid == id else { return }
|
||||
|
||||
if abs(this.lastCommunication?.timeIntervalSinceNow ?? deadlineMs) >= deadlineMs {
|
||||
this.closeOutEngine(reason: "Ping timeout")
|
||||
} else {
|
||||
this.checkPings()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses raw binary received from engine.io.
|
||||
///
|
||||
/// - parameter data: The data to parse.
|
||||
public func parseEngineData(_ data: Data) {
|
||||
DefaultSocketLogger.Logger.log("Got binary data: %@", type: "SocketEngine", args: data)
|
||||
open func parseEngineData(_ data: Data) {
|
||||
DefaultSocketLogger.Logger.log("Got binary data: \(data)", type: SocketEngine.logType)
|
||||
|
||||
client?.parseEngineBinaryData(data.subdata(in: 1..<data.endIndex))
|
||||
lastCommunication = Date()
|
||||
|
||||
client?.parseEngineBinaryData(version.rawValue >= 3 ? data : data.subdata(in: 1..<data.endIndex))
|
||||
}
|
||||
|
||||
/// Parses a raw engine.io packet.
|
||||
///
|
||||
/// - parameter message: The message to parse.
|
||||
/// - parameter fromPolling: Whether this message is from long-polling.
|
||||
/// If `true` we might have to fix utf8 encoding.
|
||||
public func parseEngineMessage(_ message: String) {
|
||||
DefaultSocketLogger.Logger.log("Got message: %@", type: logType, args: message)
|
||||
open func parseEngineMessage(_ message: String) {
|
||||
lastCommunication = Date()
|
||||
|
||||
let reader = SocketStringReader(message: message)
|
||||
DefaultSocketLogger.Logger.log("Got message: \(message)", type: SocketEngine.logType)
|
||||
|
||||
if message.hasPrefix("b4") {
|
||||
if message.hasPrefix(version.rawValue >= 3 ? "b" : "b4") {
|
||||
return handleBase64(message: message)
|
||||
}
|
||||
|
||||
guard let type = SocketEnginePacketType(rawValue: Int(reader.currentCharacter) ?? -1) else {
|
||||
guard let type = SocketEnginePacketType(rawValue: message.first?.wholeNumberValue ?? -1) else {
|
||||
checkAndHandleEngineError(message)
|
||||
|
||||
return
|
||||
@@ -522,17 +536,19 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
|
||||
switch type {
|
||||
case .message:
|
||||
handleMessage(String(message.characters.dropFirst()))
|
||||
handleMessage(String(message.dropFirst()))
|
||||
case .noop:
|
||||
handleNOOP()
|
||||
case .ping:
|
||||
handlePing(with: message)
|
||||
case .pong:
|
||||
handlePong(with: message)
|
||||
case .open:
|
||||
handleOpen(openData: String(message.characters.dropFirst()))
|
||||
handleOpen(openData: String(message.dropFirst()))
|
||||
case .close:
|
||||
handleClose(message)
|
||||
default:
|
||||
DefaultSocketLogger.Logger.log("Got unknown packet type", type: logType)
|
||||
DefaultSocketLogger.Logger.log("Got unknown packet type", type: SocketEngine.logType)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,34 +567,85 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
sid = ""
|
||||
waitingForPoll = false
|
||||
waitingForPost = false
|
||||
websocket = false
|
||||
}
|
||||
|
||||
private func sendPing() {
|
||||
guard connected else { return }
|
||||
|
||||
// Server is not responding
|
||||
if pongsMissed > pongsMissedMax {
|
||||
client?.engineDidClose(reason: "Ping timeout")
|
||||
|
||||
guard connected, let pingInterval = pingInterval else {
|
||||
return
|
||||
}
|
||||
|
||||
guard let pingInterval = pingInterval else { return }
|
||||
// Server is not responding
|
||||
if pongsMissed > pongsMissedMax {
|
||||
closeOutEngine(reason: "Ping timeout")
|
||||
return
|
||||
}
|
||||
|
||||
pongsMissed += 1
|
||||
write("", withType: .ping, withData: [])
|
||||
write("", withType: .ping, withData: [], completion: nil)
|
||||
|
||||
engineQueue.asyncAfter(deadline: DispatchTime.now() + Double(pingInterval)) {[weak self] in self?.sendPing() }
|
||||
engineQueue.asyncAfter(deadline: .now() + .milliseconds(pingInterval)) {[weak self, id = self.sid] in
|
||||
// Make sure not to ping old connections
|
||||
guard let this = self, this.sid == id else {
|
||||
return
|
||||
}
|
||||
|
||||
this.sendPing()
|
||||
}
|
||||
|
||||
client?.engineDidSendPing()
|
||||
}
|
||||
|
||||
/// Called when the engine should set/update its configs from a given configuration.
|
||||
///
|
||||
/// parameter config: The `SocketIOClientConfiguration` that should be used to set/update configs.
|
||||
open func setConfigs(_ config: SocketIOClientConfiguration) {
|
||||
for option in config {
|
||||
switch option {
|
||||
case let .connectParams(params):
|
||||
connectParams = params
|
||||
case let .cookies(cookies):
|
||||
self.cookies = cookies
|
||||
case let .extraHeaders(headers):
|
||||
extraHeaders = headers
|
||||
case let .sessionDelegate(delegate):
|
||||
sessionDelegate = delegate
|
||||
case let .forcePolling(force):
|
||||
forcePolling = force
|
||||
case let .forceWebsockets(force):
|
||||
forceWebsockets = force
|
||||
case let .path(path):
|
||||
socketPath = path
|
||||
|
||||
if !socketPath.hasSuffix("/") {
|
||||
socketPath += "/"
|
||||
}
|
||||
case let .secure(secure):
|
||||
self.secure = secure
|
||||
case let .selfSigned(selfSigned):
|
||||
self.selfSigned = selfSigned
|
||||
case let .security(pinner):
|
||||
self.certPinner = pinner
|
||||
case .compress:
|
||||
self.compress = true
|
||||
case .enableSOCKSProxy:
|
||||
self.enableSOCKSProxy = true
|
||||
case let .useCustomEngine(enable):
|
||||
self.useCustomEngine = enable
|
||||
case let .version(num):
|
||||
version = num
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Moves from long-polling to websockets
|
||||
private func upgradeTransport() {
|
||||
if ws?.isConnected ?? false {
|
||||
DefaultSocketLogger.Logger.log("Upgrading transport to WebSockets", type: logType)
|
||||
if wsConnected {
|
||||
DefaultSocketLogger.Logger.log("Upgrading transport to WebSockets", type: SocketEngine.logType)
|
||||
|
||||
fastUpgrade = true
|
||||
sendPollMessage("", withType: .noop, withData: [])
|
||||
sendPollMessage("", withType: .noop, withData: [], completion: nil)
|
||||
// After this point, we should not send anymore polling messages
|
||||
}
|
||||
}
|
||||
@@ -586,30 +653,37 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
/// Writes a message to engine.io, independent of transport.
|
||||
///
|
||||
/// - parameter msg: The message to send.
|
||||
/// - parameter withType: The type of this message.
|
||||
/// - parameter withData: Any data that this message has.
|
||||
public func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data]) {
|
||||
/// - parameter type: The type of this message.
|
||||
/// - parameter data: Any data that this message has.
|
||||
/// - parameter completion: Callback called on transport write completion.
|
||||
open func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data], completion: (() -> ())? = nil) {
|
||||
engineQueue.async {
|
||||
guard self.connected else { return }
|
||||
guard self.connected else {
|
||||
completion?()
|
||||
return
|
||||
}
|
||||
|
||||
if self.websocket {
|
||||
DefaultSocketLogger.Logger.log("Writing ws: %@ has data: %@",
|
||||
type: self.logType, args: msg, data.count != 0)
|
||||
self.sendWebSocketMessage(msg, withType: type, withData: data)
|
||||
} else if !self.probing {
|
||||
DefaultSocketLogger.Logger.log("Writing poll: %@ has data: %@",
|
||||
type: self.logType, args: msg, data.count != 0)
|
||||
self.sendPollMessage(msg, withType: type, withData: data)
|
||||
guard !self.probing else {
|
||||
self.probeWait.append((msg, type, data, completion))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if self.polling {
|
||||
DefaultSocketLogger.Logger.log("Writing poll: \(msg) has data: \(data.count != 0)",
|
||||
type: SocketEngine.logType)
|
||||
self.sendPollMessage(msg, withType: type, withData: data, completion: completion)
|
||||
} else {
|
||||
self.probeWait.append((msg, type, data))
|
||||
DefaultSocketLogger.Logger.log("Writing ws: \(msg) has data: \(data.count != 0)",
|
||||
type: SocketEngine.logType)
|
||||
self.sendWebSocketMessage(msg, withType: type, withData: data, completion: completion)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Starscream delegate conformance
|
||||
// WebSocket Methods
|
||||
|
||||
/// Delegate method for connection.
|
||||
public func websocketDidConnect(socket: WebSocket) {
|
||||
private func websocketDidConnect() {
|
||||
if !forceWebsockets {
|
||||
probing = true
|
||||
probeWebSocket()
|
||||
@@ -620,8 +694,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
}
|
||||
}
|
||||
|
||||
/// Delegate method for disconnection.
|
||||
public func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
|
||||
private func websocketDidDisconnect(error: Error?) {
|
||||
probing = false
|
||||
|
||||
if closed {
|
||||
@@ -630,21 +703,29 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
return
|
||||
}
|
||||
|
||||
guard websocket else {
|
||||
guard !polling else {
|
||||
flushProbeWait()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
connected = false
|
||||
websocket = false
|
||||
polling = true
|
||||
|
||||
if let reason = error?.localizedDescription {
|
||||
if let error = error as? WSError {
|
||||
didError(reason: "\(error.message). code=\(error.code), type=\(error.type)")
|
||||
} else if let reason = error?.localizedDescription {
|
||||
didError(reason: reason)
|
||||
} else {
|
||||
client?.engineDidClose(reason: "Socket Disconnected")
|
||||
}
|
||||
}
|
||||
|
||||
// Test Properties
|
||||
|
||||
func setConnected(_ value: Bool) {
|
||||
connected = value
|
||||
}
|
||||
}
|
||||
|
||||
extension SocketEngine {
|
||||
@@ -657,3 +738,41 @@ extension SocketEngine {
|
||||
didError(reason: "Engine URLSession became invalid")
|
||||
}
|
||||
}
|
||||
|
||||
enum EngineError: Error {
|
||||
case canceled
|
||||
}
|
||||
|
||||
extension SocketEngine {
|
||||
/// Delegate method for WebSocketDelegate.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - event: WS Event
|
||||
/// - _:
|
||||
public func didReceive(event: Starscream.WebSocketEvent, client: Starscream.WebSocketClient) {
|
||||
switch event {
|
||||
case let .connected(headers):
|
||||
wsConnected = true
|
||||
self.client?.engineDidWebsocketUpgrade(headers: headers)
|
||||
websocketDidConnect()
|
||||
case .cancelled:
|
||||
wsConnected = false
|
||||
websocketDidDisconnect(error: EngineError.canceled)
|
||||
case .disconnected(_, _):
|
||||
wsConnected = false
|
||||
websocketDidDisconnect(error: nil)
|
||||
case .viabilityChanged(false):
|
||||
wsConnected = false
|
||||
websocketDidDisconnect(error: nil)
|
||||
case .peerClosed:
|
||||
wsConnected = false
|
||||
websocketDidDisconnect(error: nil)
|
||||
case let .text(msg):
|
||||
parseEngineMessage(msg)
|
||||
case let .binary(data):
|
||||
parseEngineData(data)
|
||||
case _:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,18 @@ import Foundation
|
||||
/// - parameter reason: The reason the engine opened.
|
||||
func engineDidOpen(reason: String)
|
||||
|
||||
/// Called when the engine receives a ping message. Only called in socket.io >3.
|
||||
func engineDidReceivePing()
|
||||
|
||||
/// Called when the engine receives a pong message. Only called in socket.io 2.
|
||||
func engineDidReceivePong()
|
||||
|
||||
/// Called when the engine sends a ping to the server. Only called in socket.io 2.
|
||||
func engineDidSendPing()
|
||||
|
||||
/// Called when the engine sends a pong to the server. Only called in socket.io >3.
|
||||
func engineDidSendPong()
|
||||
|
||||
/// Called when the engine has a message that must be parsed.
|
||||
///
|
||||
/// - parameter msg: The message that needs parsing.
|
||||
@@ -53,4 +65,9 @@ import Foundation
|
||||
///
|
||||
/// - parameter data: The data the engine received.
|
||||
func parseEngineBinaryData(_ data: Data)
|
||||
|
||||
/// Called when when upgrading the http connection to a websocket connection.
|
||||
///
|
||||
/// - parameter headers: The http headers.
|
||||
func engineDidWebsocketUpgrade(headers: [String: String])
|
||||
}
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
import Foundation
|
||||
|
||||
/// Represents the type of engine.io packet types.
|
||||
@objc public enum SocketEnginePacketType : Int {
|
||||
@objc public enum SocketEnginePacketType: Int {
|
||||
/// Open message.
|
||||
case open
|
||||
|
||||
+61
-45
@@ -25,8 +25,8 @@
|
||||
import Foundation
|
||||
|
||||
/// Protocol that is used to implement socket.io polling support
|
||||
public protocol SocketEnginePollable : SocketEngineSpec {
|
||||
/// MARK: Properties
|
||||
public protocol SocketEnginePollable: SocketEngineSpec {
|
||||
// MARK: Properties
|
||||
|
||||
/// `true` If engine's session has been invalidated.
|
||||
var invalidated: Bool { get }
|
||||
@@ -34,7 +34,7 @@ public protocol SocketEnginePollable : SocketEngineSpec {
|
||||
/// A queue of engine.io messages waiting for POSTing
|
||||
///
|
||||
/// **You should not touch this directly**
|
||||
var postWait: [String] { get set }
|
||||
var postWait: [Post] { get set }
|
||||
|
||||
/// The URLSession that will be used for polling.
|
||||
var session: URLSession? { get }
|
||||
@@ -51,6 +51,8 @@ public protocol SocketEnginePollable : SocketEngineSpec {
|
||||
/// **Do not touch this directly**
|
||||
var waitingForPost: Bool { get set }
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
/// Call to send a long-polling request.
|
||||
///
|
||||
/// You shouldn't need to call this directly, the engine should automatically maintain a long-poll request.
|
||||
@@ -63,7 +65,7 @@ public protocol SocketEnginePollable : SocketEngineSpec {
|
||||
/// - parameter message: The message to send.
|
||||
/// - parameter withType: The type of message to send.
|
||||
/// - parameter withData: The data associated with this message.
|
||||
func sendPollMessage(_ message: String, withType type: SocketEnginePacketType, withData datas: [Data])
|
||||
func sendPollMessage(_ message: String, withType type: SocketEnginePacketType, withData datas: [Data], completion: (() -> ())?)
|
||||
|
||||
/// Call to stop polling and invalidate the URLSession.
|
||||
func stopPolling()
|
||||
@@ -71,29 +73,23 @@ public protocol SocketEnginePollable : SocketEngineSpec {
|
||||
|
||||
// Default polling methods
|
||||
extension SocketEnginePollable {
|
||||
private func addHeaders(to req: inout URLRequest) {
|
||||
if cookies != nil {
|
||||
let headers = HTTPCookie.requestHeaderFields(with: cookies!)
|
||||
req.allHTTPHeaderFields = headers
|
||||
}
|
||||
|
||||
if extraHeaders != nil {
|
||||
for (headerName, value) in extraHeaders! {
|
||||
req.setValue(value, forHTTPHeaderField: headerName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func createRequestForPostWithPostWait() -> URLRequest {
|
||||
defer { postWait.removeAll(keepingCapacity: true) }
|
||||
defer {
|
||||
for packet in postWait { packet.completion?() }
|
||||
postWait.removeAll(keepingCapacity: true)
|
||||
}
|
||||
|
||||
var postStr = ""
|
||||
|
||||
for packet in postWait {
|
||||
postStr += "\(packet.utf16.count):\(packet)"
|
||||
if version.rawValue >= 3 {
|
||||
postStr = postWait.lazy.map({ $0.msg }).joined(separator: "\u{1e}")
|
||||
} else {
|
||||
for packet in postWait {
|
||||
postStr += "\(packet.msg.utf16.count):\(packet.msg)"
|
||||
}
|
||||
}
|
||||
|
||||
DefaultSocketLogger.Logger.log("Created POST string: %@", type: "SocketEnginePolling", args: postStr)
|
||||
DefaultSocketLogger.Logger.log("Created POST string: \(postStr)", type: "SocketEnginePolling")
|
||||
|
||||
var req = URLRequest(url: urlPollingWithSid)
|
||||
let postData = postStr.data(using: .utf8, allowLossyConversion: false)!
|
||||
@@ -112,7 +108,7 @@ extension SocketEnginePollable {
|
||||
///
|
||||
/// You shouldn't need to call this directly, the engine should automatically maintain a long-poll request.
|
||||
public func doPoll() {
|
||||
guard !websocket && !waitingForPoll && connected && !closed else { return }
|
||||
guard polling && !waitingForPoll && connected && !closed else { return }
|
||||
|
||||
var req = URLRequest(url: urlPollingWithSid)
|
||||
addHeaders(to: &req)
|
||||
@@ -123,8 +119,7 @@ extension SocketEnginePollable {
|
||||
func doRequest(for req: URLRequest, callbackWith callback: @escaping (Data?, URLResponse?, Error?) -> ()) {
|
||||
guard polling && !closed && !invalidated && !fastUpgrade else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Doing polling %@ %@", type: "SocketEnginePolling",
|
||||
args: req.httpMethod ?? "", req)
|
||||
DefaultSocketLogger.Logger.log("Doing polling \(req.httpMethod ?? "") \(req)", type: "SocketEnginePolling")
|
||||
|
||||
session?.dataTask(with: req, completionHandler: callback).resume()
|
||||
}
|
||||
@@ -134,9 +129,12 @@ extension SocketEnginePollable {
|
||||
|
||||
doRequest(for: req) {[weak self] data, res, err in
|
||||
guard let this = self, this.polling else { return }
|
||||
|
||||
if err != nil || data == nil {
|
||||
DefaultSocketLogger.Logger.error(err?.localizedDescription ?? "Error", type: "SocketEnginePolling")
|
||||
guard let data = data, let res = res as? HTTPURLResponse, res.statusCode == 200 else {
|
||||
if let err = err {
|
||||
DefaultSocketLogger.Logger.error(err.localizedDescription, type: "SocketEnginePolling")
|
||||
} else {
|
||||
DefaultSocketLogger.Logger.error("Error during long poll request", type: "SocketEnginePolling")
|
||||
}
|
||||
|
||||
if this.polling {
|
||||
this.didError(reason: err?.localizedDescription ?? "Error")
|
||||
@@ -147,7 +145,7 @@ extension SocketEnginePollable {
|
||||
|
||||
DefaultSocketLogger.Logger.log("Got polling response", type: "SocketEnginePolling")
|
||||
|
||||
if let str = String(data: data!, encoding: .utf8) {
|
||||
if let str = String(data: data, encoding: .utf8) {
|
||||
this.parsePollingMessage(str)
|
||||
}
|
||||
|
||||
@@ -163,7 +161,7 @@ extension SocketEnginePollable {
|
||||
|
||||
private func flushWaitingForPost() {
|
||||
guard postWait.count != 0 && connected else { return }
|
||||
guard !websocket else {
|
||||
guard polling else {
|
||||
flushWaitingForPostToWebSocket()
|
||||
|
||||
return
|
||||
@@ -175,11 +173,14 @@ extension SocketEnginePollable {
|
||||
|
||||
DefaultSocketLogger.Logger.log("POSTing", type: "SocketEnginePolling")
|
||||
|
||||
doRequest(for: req) {[weak self] data, res, err in
|
||||
doRequest(for: req) {[weak self] _, res, err in
|
||||
guard let this = self else { return }
|
||||
|
||||
if err != nil {
|
||||
DefaultSocketLogger.Logger.error(err?.localizedDescription ?? "Error", type: "SocketEnginePolling")
|
||||
guard let res = res as? HTTPURLResponse, res.statusCode == 200 else {
|
||||
if let err = err {
|
||||
DefaultSocketLogger.Logger.error(err.localizedDescription, type: "SocketEnginePolling")
|
||||
} else {
|
||||
DefaultSocketLogger.Logger.error("Error flushing waiting posts", type: "SocketEnginePolling")
|
||||
}
|
||||
|
||||
if this.polling {
|
||||
this.didError(reason: err?.localizedDescription ?? "Error")
|
||||
@@ -198,18 +199,32 @@ extension SocketEnginePollable {
|
||||
}
|
||||
|
||||
func parsePollingMessage(_ str: String) {
|
||||
guard str.characters.count != 1 else { return }
|
||||
guard !str.isEmpty else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Got poll message: %@", type: "SocketEnginePolling", args: str)
|
||||
DefaultSocketLogger.Logger.log("Got poll message: \(str)", type: "SocketEnginePolling")
|
||||
|
||||
var reader = SocketStringReader(message: str)
|
||||
if version.rawValue >= 3 {
|
||||
let records = str.components(separatedBy: "\u{1e}")
|
||||
|
||||
while reader.hasNext {
|
||||
if let n = Int(reader.readUntilOccurence(of: ":")) {
|
||||
parseEngineMessage(reader.read(count: n))
|
||||
} else {
|
||||
for record in records {
|
||||
parseEngineMessage(record)
|
||||
}
|
||||
} else {
|
||||
guard str.count != 1 else {
|
||||
parseEngineMessage(str)
|
||||
break
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var reader = SocketStringReader(message: str)
|
||||
|
||||
while reader.hasNext {
|
||||
if let n = Int(reader.readUntilOccurence(of: ":")) {
|
||||
parseEngineMessage(reader.read(count: n))
|
||||
} else {
|
||||
parseEngineMessage(str)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,14 +236,15 @@ extension SocketEnginePollable {
|
||||
/// - parameter message: The message to send.
|
||||
/// - parameter withType: The type of message to send.
|
||||
/// - parameter withData: The data associated with this message.
|
||||
public func sendPollMessage(_ message: String, withType type: SocketEnginePacketType, withData datas: [Data]) {
|
||||
DefaultSocketLogger.Logger.log("Sending poll: %@ as type: %@", type: "SocketEnginePolling", args: message, type.rawValue)
|
||||
/// - parameter completion: Callback called on transport write completion.
|
||||
public func sendPollMessage(_ message: String, withType type: SocketEnginePacketType, withData datas: [Data], completion: (() -> ())? = nil) {
|
||||
DefaultSocketLogger.Logger.log("Sending poll: \(message) as type: \(type.rawValue)", type: "SocketEnginePolling")
|
||||
|
||||
postWait.append(String(type.rawValue) + message)
|
||||
postWait.append((String(type.rawValue) + message, completion))
|
||||
|
||||
for data in datas {
|
||||
if case let .right(bin) = createBinaryDataForSend(using: data) {
|
||||
postWait.append(bin)
|
||||
postWait.append((bin, {}))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,15 +24,21 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Starscream
|
||||
|
||||
/// Specifies a SocketEngine.
|
||||
@objc public protocol SocketEngineSpec {
|
||||
public protocol SocketEngineSpec: AnyObject {
|
||||
// MARK: Properties
|
||||
|
||||
/// The client for this engine.
|
||||
weak var client: SocketEngineClient? { get set }
|
||||
var client: SocketEngineClient? { get set }
|
||||
|
||||
/// `true` if this engine is closed.
|
||||
var closed: Bool { get }
|
||||
|
||||
/// If `true` the engine will attempt to use WebSocket compression.
|
||||
var compress: Bool { get }
|
||||
|
||||
/// `true` if this engine is connected. Connected means that the initial poll connect has succeeded.
|
||||
var connected: Bool { get }
|
||||
|
||||
@@ -46,7 +52,7 @@ import Foundation
|
||||
var engineQueue: DispatchQueue { get }
|
||||
|
||||
/// A dictionary of extra http headers that will be set during connection.
|
||||
var extraHeaders: [String: String]? { get }
|
||||
var extraHeaders: [String: String]? { get set }
|
||||
|
||||
/// When `true`, the engine is in the process of switching to WebSockets.
|
||||
var fastUpgrade: Bool { get }
|
||||
@@ -75,18 +81,26 @@ import Foundation
|
||||
/// The url for WebSockets.
|
||||
var urlWebSocket: URL { get }
|
||||
|
||||
/// The version of engine.io being used. Default is three.
|
||||
var version: SocketIOVersion { get }
|
||||
|
||||
/// If `true`, then the engine is currently in WebSockets mode.
|
||||
@available(*, deprecated, message: "No longer needed, if we're not polling, then we must be doing websockets")
|
||||
var websocket: Bool { get }
|
||||
|
||||
/// The WebSocket for this engine.
|
||||
var ws: WebSocket? { get }
|
||||
|
||||
// MARK: Initializers
|
||||
|
||||
/// Creates a new engine.
|
||||
///
|
||||
/// - parameter client: The client for this engine.
|
||||
/// - parameter url: The url for this engine.
|
||||
/// - parameter options: The options for this engine.
|
||||
init(client: SocketEngineClient, url: URL, options: NSDictionary?)
|
||||
init(client: SocketEngineClient, url: URL, options: [String: Any]?)
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
/// Starts the connection to the server.
|
||||
func connect()
|
||||
@@ -119,23 +133,35 @@ import Foundation
|
||||
/// Parses a raw engine.io packet.
|
||||
///
|
||||
/// - parameter message: The message to parse.
|
||||
/// - parameter fromPolling: Whether this message is from long-polling.
|
||||
/// If `true` we might have to fix utf8 encoding.
|
||||
func parseEngineMessage(_ message: String)
|
||||
|
||||
/// Writes a message to engine.io, independent of transport.
|
||||
///
|
||||
/// - parameter msg: The message to send.
|
||||
/// - parameter withType: The type of this message.
|
||||
/// - parameter withData: Any data that this message has.
|
||||
func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data])
|
||||
/// - parameter type: The type of this message.
|
||||
/// - parameter data: Any data that this message has.
|
||||
/// - parameter completion: Callback called on transport write completion.
|
||||
func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data], completion: (() -> ())?)
|
||||
}
|
||||
|
||||
extension SocketEngineSpec {
|
||||
var engineIOParam: String {
|
||||
switch version {
|
||||
case .two:
|
||||
return "&EIO=3"
|
||||
case .three:
|
||||
return "&EIO=4"
|
||||
}
|
||||
}
|
||||
|
||||
var urlPollingWithSid: URL {
|
||||
var com = URLComponents(url: urlPolling, resolvingAgainstBaseURL: false)!
|
||||
com.percentEncodedQuery = com.percentEncodedQuery! + "&sid=\(sid.urlEncode()!)"
|
||||
|
||||
if !com.percentEncodedQuery!.contains("EIO") {
|
||||
com.percentEncodedQuery = com.percentEncodedQuery! + engineIOParam
|
||||
}
|
||||
|
||||
return com.url!
|
||||
}
|
||||
|
||||
@@ -143,24 +169,41 @@ extension SocketEngineSpec {
|
||||
var com = URLComponents(url: urlWebSocket, resolvingAgainstBaseURL: false)!
|
||||
com.percentEncodedQuery = com.percentEncodedQuery! + (sid == "" ? "" : "&sid=\(sid.urlEncode()!)")
|
||||
|
||||
if !com.percentEncodedQuery!.contains("EIO") {
|
||||
com.percentEncodedQuery = com.percentEncodedQuery! + engineIOParam
|
||||
}
|
||||
|
||||
|
||||
return com.url!
|
||||
}
|
||||
|
||||
func addHeaders(to req: inout URLRequest, includingCookies additionalCookies: [HTTPCookie]? = nil) {
|
||||
var cookiesToAdd: [HTTPCookie] = cookies ?? []
|
||||
cookiesToAdd += additionalCookies ?? []
|
||||
|
||||
if !cookiesToAdd.isEmpty {
|
||||
req.allHTTPHeaderFields = HTTPCookie.requestHeaderFields(with: cookiesToAdd)
|
||||
}
|
||||
|
||||
if let extraHeaders = extraHeaders {
|
||||
for (headerName, value) in extraHeaders {
|
||||
req.setValue(value, forHTTPHeaderField: headerName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func createBinaryDataForSend(using data: Data) -> Either<Data, String> {
|
||||
if websocket {
|
||||
var byteArray = [UInt8](repeating: 0x4, count: 1)
|
||||
let mutData = NSMutableData(bytes: &byteArray, length: 1)
|
||||
let prefixB64 = version.rawValue >= 3 ? "b" : "b4"
|
||||
|
||||
mutData.append(data)
|
||||
|
||||
return .left(mutData as Data)
|
||||
if polling {
|
||||
return .right(prefixB64 + data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)))
|
||||
} else {
|
||||
return .right("b4" + data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)))
|
||||
return .left(version.rawValue >= 3 ? data : Data([0x4]) + data)
|
||||
}
|
||||
}
|
||||
|
||||
/// Send an engine message (4)
|
||||
func send(_ msg: String, withData datas: [Data]) {
|
||||
write(msg, withType: .message, withData: datas)
|
||||
func send(_ msg: String, withData datas: [Data], completion: (() -> ())? = nil) {
|
||||
write(msg, withType: .message, withData: datas, completion: completion)
|
||||
}
|
||||
}
|
||||
+29
-20
@@ -24,9 +24,17 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Starscream
|
||||
|
||||
/// Protocol that is used to implement socket.io WebSocket support
|
||||
public protocol SocketEngineWebsocket : SocketEngineSpec, WebSocketDelegate {
|
||||
public protocol SocketEngineWebsocket: SocketEngineSpec {
|
||||
// MARK: Properties
|
||||
|
||||
/// Whether or not the ws is connected
|
||||
var wsConnected: Bool { get }
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
/// Sends an engine.io message through the WebSocket transport.
|
||||
///
|
||||
/// You shouldn't call this directly, instead call the `write` method on `SocketEngine`.
|
||||
@@ -34,14 +42,18 @@ public protocol SocketEngineWebsocket : SocketEngineSpec, WebSocketDelegate {
|
||||
/// - parameter message: The message to send.
|
||||
/// - parameter withType: The type of message to send.
|
||||
/// - parameter withData: The data associated with this message.
|
||||
func sendWebSocketMessage(_ str: String, withType type: SocketEnginePacketType, withData datas: [Data])
|
||||
/// - parameter completion: Callback called on transport write completion.
|
||||
func sendWebSocketMessage(_ str: String,
|
||||
withType type: SocketEnginePacketType,
|
||||
withData datas: [Data],
|
||||
completion: (() -> ())?)
|
||||
}
|
||||
|
||||
// WebSocket methods
|
||||
extension SocketEngineWebsocket {
|
||||
func probeWebSocket() {
|
||||
if ws?.isConnected ?? false {
|
||||
sendWebSocketMessage("probe", withType: .ping, withData: [])
|
||||
if wsConnected {
|
||||
sendWebSocketMessage("probe", withType: .ping, withData: [], completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,27 +64,24 @@ extension SocketEngineWebsocket {
|
||||
/// - parameter message: The message to send.
|
||||
/// - parameter withType: The type of message to send.
|
||||
/// - parameter withData: The data associated with this message.
|
||||
public func sendWebSocketMessage(_ str: String, withType type: SocketEnginePacketType, withData datas: [Data]) {
|
||||
DefaultSocketLogger.Logger.log("Sending ws: %@ as type: %@", type: "SocketEngine", args: str, type.rawValue)
|
||||
/// - parameter completion: Callback called on transport write completion.
|
||||
public func sendWebSocketMessage(_ str: String,
|
||||
withType type: SocketEnginePacketType,
|
||||
withData data: [Data],
|
||||
completion: (() -> ())?
|
||||
) {
|
||||
DefaultSocketLogger.Logger.log("Sending ws: \(str) as type: \(type.rawValue)", type: "SocketEngineWebSocket")
|
||||
|
||||
ws?.write(string: "\(type.rawValue)\(str)")
|
||||
|
||||
for data in datas {
|
||||
if case let .left(bin) = createBinaryDataForSend(using: data) {
|
||||
ws?.write(data: bin)
|
||||
for item in data {
|
||||
if case let .left(bin) = createBinaryDataForSend(using: item) {
|
||||
ws?.write(data: bin, completion: completion)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Starscream delegate methods
|
||||
|
||||
/// Delegate method for when a message is received.
|
||||
public func websocketDidReceiveMessage(socket: WebSocket, text: String) {
|
||||
parseEngineMessage(text)
|
||||
}
|
||||
|
||||
/// Delegate method for when binary is received.
|
||||
public func websocketDidReceiveData(socket: WebSocket, data: Data) {
|
||||
parseEngineData(data)
|
||||
if data.count == 0 {
|
||||
completion?()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,613 @@
|
||||
//
|
||||
// Created by Erik Little on 10/14/17.
|
||||
//
|
||||
// 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.
|
||||
|
||||
import Dispatch
|
||||
import Foundation
|
||||
|
||||
///
|
||||
/// A manager for a socket.io connection.
|
||||
///
|
||||
/// A `SocketManager` is responsible for multiplexing multiple namespaces through a single `SocketEngineSpec`.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// let manager = SocketManager(socketURL: URL(string:"http://localhost:8080/")!)
|
||||
/// let defaultNamespaceSocket = manager.defaultSocket
|
||||
/// let swiftSocket = manager.socket(forNamespace: "/swift")
|
||||
///
|
||||
/// // defaultNamespaceSocket and swiftSocket both share a single connection to the server
|
||||
/// ```
|
||||
///
|
||||
/// Sockets created through the manager are retained by the manager. So at the very least, a single strong reference
|
||||
/// to the manager must be maintained to keep sockets alive.
|
||||
///
|
||||
/// To disconnect a socket and remove it from the manager, either call `SocketIOClient.disconnect()` on the socket,
|
||||
/// or call one of the `disconnectSocket` methods on this class.
|
||||
///
|
||||
/// **NOTE**: The manager is not thread/queue safe, all interaction with the manager should be done on the `handleQueue`
|
||||
///
|
||||
open class SocketManager: NSObject, SocketManagerSpec, SocketParsable, SocketDataBufferable, ConfigSettable {
|
||||
private static let logType = "SocketManager"
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// The socket associated with the default namespace ("/").
|
||||
public var defaultSocket: SocketIOClient {
|
||||
return socket(forNamespace: "/")
|
||||
}
|
||||
|
||||
/// The URL of the socket.io server.
|
||||
///
|
||||
/// If changed after calling `init`, `forceNew` must be set to `true`, or it will only connect to the url set in the
|
||||
/// init.
|
||||
public let socketURL: URL
|
||||
|
||||
/// The configuration for this client.
|
||||
///
|
||||
/// **Some configs will not take affect until after a reconnect if set after calling a connect method**.
|
||||
public var config: SocketIOClientConfiguration {
|
||||
get {
|
||||
return _config
|
||||
}
|
||||
|
||||
set {
|
||||
if status.active {
|
||||
DefaultSocketLogger.Logger.log("Setting configs on active manager. Some configs may not be applied until reconnect",
|
||||
type: SocketManager.logType)
|
||||
}
|
||||
|
||||
setConfigs(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
/// The engine for this manager.
|
||||
public var engine: SocketEngineSpec?
|
||||
|
||||
/// If `true` then every time `connect` is called, a new engine will be created.
|
||||
public var forceNew = false
|
||||
|
||||
/// The queue that all interaction with the client should occur on. This is the queue that event handlers are
|
||||
/// called on.
|
||||
///
|
||||
/// **This should be a serial queue! Concurrent queues are not supported and might cause crashes and races**.
|
||||
public var handleQueue = DispatchQueue.main
|
||||
|
||||
/// The sockets in this manager indexed by namespace.
|
||||
public var nsps = [String: SocketIOClient]()
|
||||
|
||||
/// If `true`, this client will try and reconnect on any disconnects.
|
||||
public var reconnects = true
|
||||
|
||||
/// The minimum number of seconds to wait before attempting to reconnect.
|
||||
public var reconnectWait = 10
|
||||
|
||||
/// The maximum number of seconds to wait before attempting to reconnect.
|
||||
public var reconnectWaitMax = 30
|
||||
|
||||
/// The randomization factor for calculating reconnect jitter.
|
||||
public var randomizationFactor = 0.5
|
||||
|
||||
/// The status of this manager.
|
||||
public private(set) var status: SocketIOStatus = .notConnected {
|
||||
didSet {
|
||||
switch status {
|
||||
case .connected:
|
||||
reconnecting = false
|
||||
currentReconnectAttempt = 0
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public private(set) var version = SocketIOVersion.three
|
||||
|
||||
/// A list of packets that are waiting for binary data.
|
||||
///
|
||||
/// The way that socket.io works all data should be sent directly after each packet.
|
||||
/// So this should ideally be an array of one packet waiting for data.
|
||||
///
|
||||
/// **This should not be modified directly.**
|
||||
public var waitingPackets = [SocketPacket]()
|
||||
|
||||
private(set) var reconnectAttempts = -1
|
||||
|
||||
private var _config: SocketIOClientConfiguration
|
||||
internal var currentReconnectAttempt = 0
|
||||
private var reconnecting = false
|
||||
|
||||
// MARK: Initializers
|
||||
|
||||
/// Type safe way to create a new SocketIOClient. `opts` can be omitted.
|
||||
///
|
||||
/// - parameter socketURL: The url of the socket.io server.
|
||||
/// - parameter config: The config for this socket.
|
||||
public init(socketURL: URL, config: SocketIOClientConfiguration = []) {
|
||||
self._config = config
|
||||
self.socketURL = socketURL
|
||||
|
||||
super.init()
|
||||
|
||||
setConfigs(_config)
|
||||
}
|
||||
|
||||
/// 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>)`
|
||||
///
|
||||
/// - parameter socketURL: The url of the socket.io server.
|
||||
/// - parameter config: The config for this socket.
|
||||
@objc
|
||||
public convenience init(socketURL: URL, config: [String: Any]?) {
|
||||
self.init(socketURL: socketURL, config: config?.toSocketConfiguration() ?? [])
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
deinit {
|
||||
DefaultSocketLogger.Logger.log("Manager is being released", type: SocketManager.logType)
|
||||
|
||||
engine?.disconnect(reason: "Manager Deinit")
|
||||
}
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
private func addEngine() {
|
||||
DefaultSocketLogger.Logger.log("Adding engine", type: SocketManager.logType)
|
||||
|
||||
engine?.engineQueue.sync {
|
||||
self.engine?.client = nil
|
||||
|
||||
// Close old engine so it will not leak because of URLSession if in polling mode
|
||||
self.engine?.disconnect(reason: "Adding new engine")
|
||||
}
|
||||
|
||||
engine = SocketEngine(client: self, url: socketURL, config: config)
|
||||
}
|
||||
|
||||
/// Connects the underlying transport and the default namespace socket.
|
||||
///
|
||||
/// Override if you wish to attach a custom `SocketEngineSpec`.
|
||||
open func connect() {
|
||||
if status == .connected || (status == .connecting && currentReconnectAttempt == 0) {
|
||||
DefaultSocketLogger.Logger.log("Tried connecting an already active socket", type: SocketManager.logType)
|
||||
return
|
||||
}
|
||||
|
||||
if engine == nil || forceNew {
|
||||
addEngine()
|
||||
}
|
||||
|
||||
status = .connecting
|
||||
|
||||
engine?.connect()
|
||||
}
|
||||
|
||||
/// Connects a socket through this manager's engine.
|
||||
///
|
||||
/// - parameter socket: The socket who we should connect through this manager.
|
||||
/// - parameter withPayload: Optional payload to send on connect
|
||||
open func connectSocket(_ socket: SocketIOClient, withPayload payload: [String: Any]? = nil) {
|
||||
guard status == .connected else {
|
||||
DefaultSocketLogger.Logger.log("Tried connecting socket when engine isn't open. Connecting",
|
||||
type: SocketManager.logType)
|
||||
|
||||
connect()
|
||||
return
|
||||
}
|
||||
|
||||
var payloadStr = ""
|
||||
|
||||
if version.rawValue >= 3 && payload != nil,
|
||||
let payloadData = try? JSONSerialization.data(withJSONObject: payload!, options: .fragmentsAllowed),
|
||||
let jsonString = String(data: payloadData, encoding: .utf8) {
|
||||
payloadStr = jsonString
|
||||
}
|
||||
|
||||
engine?.send("0\(socket.nsp),\(payloadStr)", withData: [])
|
||||
}
|
||||
|
||||
/// Called when the manager has disconnected from socket.io.
|
||||
///
|
||||
/// - parameter reason: The reason for the disconnection.
|
||||
open func didDisconnect(reason: String) {
|
||||
forAll {socket in
|
||||
socket.didDisconnect(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
/// Disconnects the manager and all associated sockets.
|
||||
open func disconnect() {
|
||||
DefaultSocketLogger.Logger.log("Manager closing", type: SocketManager.logType)
|
||||
|
||||
status = .disconnected
|
||||
|
||||
engine?.disconnect(reason: "Disconnect")
|
||||
}
|
||||
|
||||
/// Disconnects the given socket.
|
||||
///
|
||||
/// This will remove the socket for the manager's control, and make the socket instance useless and ready for
|
||||
/// releasing.
|
||||
///
|
||||
/// - parameter socket: The socket to disconnect.
|
||||
open func disconnectSocket(_ socket: SocketIOClient) {
|
||||
engine?.send("1\(socket.nsp),", withData: [])
|
||||
|
||||
socket.didDisconnect(reason: "Namespace leave")
|
||||
}
|
||||
|
||||
/// Disconnects the socket associated with `forNamespace`.
|
||||
///
|
||||
/// This will remove the socket for the manager's control, and make the socket instance useless and ready for
|
||||
/// releasing.
|
||||
///
|
||||
/// - parameter nsp: The namespace to disconnect from.
|
||||
open func disconnectSocket(forNamespace nsp: String) {
|
||||
guard let socket = nsps.removeValue(forKey: nsp) else {
|
||||
DefaultSocketLogger.Logger.log("Could not find socket for \(nsp) to disconnect",
|
||||
type: SocketManager.logType)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
disconnectSocket(socket)
|
||||
}
|
||||
|
||||
/// Sends a client event to all sockets in `nsps`
|
||||
///
|
||||
/// - parameter clientEvent: The event to emit.
|
||||
open func emitAll(clientEvent event: SocketClientEvent, data: [Any]) {
|
||||
forAll {socket in
|
||||
socket.handleClientEvent(event, data: data)
|
||||
}
|
||||
}
|
||||
|
||||
/// Sends an event to the server on all namespaces in this manager.
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The data to send with this event.
|
||||
open func emitAll(_ event: String, _ items: SocketData...) {
|
||||
guard let emitData = try? items.map({ try $0.socketRepresentation() }) else {
|
||||
DefaultSocketLogger.Logger.error("Error creating socketRepresentation for emit: \(event), \(items)",
|
||||
type: SocketManager.logType)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
forAll {socket in
|
||||
socket.emit([event] + emitData)
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when the engine closes.
|
||||
///
|
||||
/// - parameter reason: The reason that the engine closed.
|
||||
open func engineDidClose(reason: String) {
|
||||
handleQueue.async {
|
||||
self._engineDidClose(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
private func _engineDidClose(reason: String) {
|
||||
waitingPackets.removeAll()
|
||||
|
||||
if status != .disconnected {
|
||||
status = .notConnected
|
||||
}
|
||||
|
||||
if status == .disconnected || !reconnects {
|
||||
didDisconnect(reason: reason)
|
||||
} else if !reconnecting {
|
||||
reconnecting = true
|
||||
tryReconnect(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when the engine errors.
|
||||
///
|
||||
/// - parameter reason: The reason the engine errored.
|
||||
open func engineDidError(reason: String) {
|
||||
handleQueue.async {
|
||||
self._engineDidError(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
private func _engineDidError(reason: String) {
|
||||
DefaultSocketLogger.Logger.error("\(reason)", type: SocketManager.logType)
|
||||
|
||||
emitAll(clientEvent: .error, data: [reason])
|
||||
}
|
||||
|
||||
/// Called when the engine opens.
|
||||
///
|
||||
/// - parameter reason: The reason the engine opened.
|
||||
open func engineDidOpen(reason: String) {
|
||||
handleQueue.async {
|
||||
self._engineDidOpen(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
private func _engineDidOpen(reason: String) {
|
||||
DefaultSocketLogger.Logger.log("Engine opened \(reason)", type: SocketManager.logType)
|
||||
|
||||
status = .connected
|
||||
|
||||
if version.rawValue < 3 {
|
||||
nsps["/"]?.didConnect(toNamespace: "/", payload: nil)
|
||||
}
|
||||
|
||||
for (nsp, socket) in nsps where socket.status == .connecting {
|
||||
if version.rawValue < 3 && nsp == "/" {
|
||||
continue
|
||||
}
|
||||
|
||||
connectSocket(socket, withPayload: socket.connectPayload)
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when the engine receives a ping message.
|
||||
open func engineDidReceivePing() {
|
||||
handleQueue.async {
|
||||
self._engineDidReceivePing()
|
||||
}
|
||||
}
|
||||
|
||||
private func _engineDidReceivePing() {
|
||||
emitAll(clientEvent: .ping, data: [])
|
||||
}
|
||||
|
||||
/// Called when the sends a ping to the server.
|
||||
open func engineDidSendPing() {
|
||||
handleQueue.async {
|
||||
self._engineDidSendPing()
|
||||
}
|
||||
}
|
||||
|
||||
private func _engineDidSendPing() {
|
||||
emitAll(clientEvent: .ping, data: [])
|
||||
}
|
||||
|
||||
/// Called when the engine receives a pong message.
|
||||
open func engineDidReceivePong() {
|
||||
handleQueue.async {
|
||||
self._engineDidReceivePong()
|
||||
}
|
||||
}
|
||||
|
||||
private func _engineDidReceivePong() {
|
||||
emitAll(clientEvent: .pong, data: [])
|
||||
}
|
||||
|
||||
/// Called when the sends a pong to the server.
|
||||
open func engineDidSendPong() {
|
||||
handleQueue.async {
|
||||
self._engineDidSendPong()
|
||||
}
|
||||
}
|
||||
|
||||
private func _engineDidSendPong() {
|
||||
emitAll(clientEvent: .pong, data: [])
|
||||
}
|
||||
|
||||
private func forAll(do: (SocketIOClient) throws -> ()) rethrows {
|
||||
for (_, socket) in nsps {
|
||||
try `do`(socket)
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when when upgrading the http connection to a websocket connection.
|
||||
///
|
||||
/// - parameter headers: The http headers.
|
||||
open func engineDidWebsocketUpgrade(headers: [String: String]) {
|
||||
handleQueue.async {
|
||||
self._engineDidWebsocketUpgrade(headers: headers)
|
||||
}
|
||||
}
|
||||
private func _engineDidWebsocketUpgrade(headers: [String: String]) {
|
||||
emitAll(clientEvent: .websocketUpgrade, data: [headers])
|
||||
}
|
||||
|
||||
/// Called when the engine has a message that must be parsed.
|
||||
///
|
||||
/// - parameter msg: The message that needs parsing.
|
||||
open func parseEngineMessage(_ msg: String) {
|
||||
handleQueue.async {
|
||||
self._parseEngineMessage(msg)
|
||||
}
|
||||
}
|
||||
|
||||
private func _parseEngineMessage(_ msg: String) {
|
||||
guard let packet = parseSocketMessage(msg) else { return }
|
||||
guard !packet.type.isBinary else {
|
||||
waitingPackets.append(packet)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
nsps[packet.nsp]?.handlePacket(packet)
|
||||
}
|
||||
|
||||
/// Called when the engine receives binary data.
|
||||
///
|
||||
/// - parameter data: The data the engine received.
|
||||
open func parseEngineBinaryData(_ data: Data) {
|
||||
handleQueue.async {
|
||||
self._parseEngineBinaryData(data)
|
||||
}
|
||||
}
|
||||
|
||||
private func _parseEngineBinaryData(_ data: Data) {
|
||||
guard let packet = parseBinaryData(data) else { return }
|
||||
|
||||
nsps[packet.nsp]?.handlePacket(packet)
|
||||
}
|
||||
|
||||
/// Tries to reconnect to the server.
|
||||
///
|
||||
/// This will cause a `SocketClientEvent.reconnect` event to be emitted, as well as
|
||||
/// `SocketClientEvent.reconnectAttempt` events.
|
||||
open func reconnect() {
|
||||
guard !reconnecting else { return }
|
||||
|
||||
engine?.disconnect(reason: "manual reconnect")
|
||||
}
|
||||
|
||||
/// Removes the socket from the manager's control. One of the disconnect methods should be called before calling this
|
||||
/// method.
|
||||
///
|
||||
/// After calling this method the socket should no longer be considered usable.
|
||||
///
|
||||
/// - parameter socket: The socket to remove.
|
||||
/// - returns: The socket removed, if it was owned by the manager.
|
||||
@discardableResult
|
||||
open func removeSocket(_ socket: SocketIOClient) -> SocketIOClient? {
|
||||
return nsps.removeValue(forKey: socket.nsp)
|
||||
}
|
||||
|
||||
private func tryReconnect(reason: String) {
|
||||
guard reconnecting else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Starting reconnect", type: SocketManager.logType)
|
||||
|
||||
// Set status to connecting and emit reconnect for all sockets
|
||||
forAll {socket in
|
||||
guard socket.status == .connected else { return }
|
||||
|
||||
socket.setReconnecting(reason: reason)
|
||||
}
|
||||
|
||||
_tryReconnect()
|
||||
}
|
||||
|
||||
private func _tryReconnect() {
|
||||
guard reconnects && reconnecting && status != .disconnected else { return }
|
||||
|
||||
if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts {
|
||||
return didDisconnect(reason: "Reconnect Failed")
|
||||
}
|
||||
|
||||
DefaultSocketLogger.Logger.log("Trying to reconnect", type: SocketManager.logType)
|
||||
|
||||
forAll {socket in
|
||||
guard socket.status == .connecting else { return }
|
||||
|
||||
socket.handleClientEvent(.reconnectAttempt, data: [(reconnectAttempts - currentReconnectAttempt)])
|
||||
}
|
||||
|
||||
currentReconnectAttempt += 1
|
||||
connect()
|
||||
|
||||
let interval = reconnectInterval(attempts: currentReconnectAttempt)
|
||||
DefaultSocketLogger.Logger.log("Scheduling reconnect in \(interval)s", type: SocketManager.logType)
|
||||
handleQueue.asyncAfter(deadline: .now() + interval, execute: _tryReconnect)
|
||||
}
|
||||
|
||||
func reconnectInterval(attempts: Int) -> Double {
|
||||
// apply exponential factor
|
||||
let backoffFactor = pow(1.5, attempts)
|
||||
let interval = Double(reconnectWait) * Double(truncating: backoffFactor as NSNumber)
|
||||
// add in a random factor smooth thundering herds
|
||||
let rand = Double.random(in: 0 ..< 1)
|
||||
let randomFactor = rand * randomizationFactor * Double(truncating: interval as NSNumber)
|
||||
// add in random factor, and clamp to min and max values
|
||||
let combined = interval + randomFactor
|
||||
return Double(fmax(Double(reconnectWait), fmin(combined, Double(reconnectWaitMax))))
|
||||
}
|
||||
|
||||
/// Sets manager specific configs.
|
||||
///
|
||||
/// parameter config: The configs that should be set.
|
||||
open func setConfigs(_ config: SocketIOClientConfiguration) {
|
||||
for option in config {
|
||||
switch option {
|
||||
case let .forceNew(new):
|
||||
forceNew = new
|
||||
case let .handleQueue(queue):
|
||||
handleQueue = queue
|
||||
case let .reconnects(reconnects):
|
||||
self.reconnects = reconnects
|
||||
case let .reconnectAttempts(attempts):
|
||||
reconnectAttempts = attempts
|
||||
case let .reconnectWait(wait):
|
||||
reconnectWait = abs(wait)
|
||||
case let .reconnectWaitMax(wait):
|
||||
reconnectWaitMax = abs(wait)
|
||||
case let .randomizationFactor(factor):
|
||||
randomizationFactor = factor
|
||||
case let .log(log):
|
||||
DefaultSocketLogger.Logger.log = log
|
||||
case let .logger(logger):
|
||||
DefaultSocketLogger.Logger = logger
|
||||
case let .version(num):
|
||||
version = num
|
||||
case _:
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
_config = config
|
||||
|
||||
if socketURL.absoluteString.hasPrefix("https://") {
|
||||
_config.insert(.secure(true))
|
||||
}
|
||||
|
||||
_config.insert(.path("/socket.io/"), replacing: false)
|
||||
|
||||
// If `ConfigSettable` & `SocketEngineSpec`, update its configs.
|
||||
if var settableEngine = engine as? ConfigSettable & SocketEngineSpec {
|
||||
settableEngine.engineQueue.sync {
|
||||
settableEngine.setConfigs(self._config)
|
||||
}
|
||||
|
||||
engine = settableEngine
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a `SocketIOClient` for the given namespace. This socket shares a transport with the manager.
|
||||
///
|
||||
/// Calling multiple times returns the same socket.
|
||||
///
|
||||
/// Sockets created from this method are retained by the manager.
|
||||
/// Call one of the `disconnectSocket` methods on this class to remove the socket from manager control.
|
||||
/// Or call `SocketIOClient.disconnect()` on the client.
|
||||
///
|
||||
/// - parameter nsp: The namespace for the socket.
|
||||
/// - returns: A `SocketIOClient` for the given namespace.
|
||||
open func socket(forNamespace nsp: String) -> SocketIOClient {
|
||||
assert(nsp.hasPrefix("/"), "forNamespace must have a leading /")
|
||||
|
||||
if let socket = nsps[nsp] {
|
||||
return socket
|
||||
}
|
||||
|
||||
let client = SocketIOClient(manager: self, nsp: nsp)
|
||||
|
||||
nsps[nsp] = client
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
// Test properties
|
||||
|
||||
func setTestStatus(_ status: SocketIOStatus) {
|
||||
self.status = status
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
//
|
||||
// Created by Erik Little on 10/18/17.
|
||||
//
|
||||
// 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.
|
||||
|
||||
import Dispatch
|
||||
import Foundation
|
||||
|
||||
// TODO Fix the types so that we aren't using concrete types
|
||||
|
||||
///
|
||||
/// A manager for a socket.io connection.
|
||||
///
|
||||
/// A `SocketManagerSpec` is responsible for multiplexing multiple namespaces through a single `SocketEngineSpec`.
|
||||
///
|
||||
/// Example with `SocketManager`:
|
||||
///
|
||||
/// ```swift
|
||||
/// let manager = SocketManager(socketURL: URL(string:"http://localhost:8080/")!)
|
||||
/// let defaultNamespaceSocket = manager.defaultSocket
|
||||
/// let swiftSocket = manager.socket(forNamespace: "/swift")
|
||||
///
|
||||
/// // defaultNamespaceSocket and swiftSocket both share a single connection to the server
|
||||
/// ```
|
||||
///
|
||||
/// Sockets created through the manager are retained by the manager. So at the very least, a single strong reference
|
||||
/// to the manager must be maintained to keep sockets alive.
|
||||
///
|
||||
/// To disconnect a socket and remove it from the manager, either call `SocketIOClient.disconnect()` on the socket,
|
||||
/// or call one of the `disconnectSocket` methods on this class.
|
||||
///
|
||||
public protocol SocketManagerSpec : SocketEngineClient {
|
||||
// MARK: Properties
|
||||
|
||||
/// Returns the socket associated with the default namespace ("/").
|
||||
var defaultSocket: SocketIOClient { get }
|
||||
|
||||
/// The engine for this manager.
|
||||
var engine: SocketEngineSpec? { get set }
|
||||
|
||||
/// If `true` then every time `connect` is called, a new engine will be created.
|
||||
var forceNew: Bool { get set }
|
||||
|
||||
// TODO Per socket queues?
|
||||
/// The queue that all interaction with the client should occur on. This is the queue that event handlers are
|
||||
/// called on.
|
||||
var handleQueue: DispatchQueue { get set }
|
||||
|
||||
/// The sockets in this manager indexed by namespace.
|
||||
var nsps: [String: SocketIOClient] { get set }
|
||||
|
||||
/// If `true`, this manager will try and reconnect on any disconnects.
|
||||
var reconnects: Bool { get set }
|
||||
|
||||
/// The minimum number of seconds to wait before attempting to reconnect.
|
||||
var reconnectWait: Int { get set }
|
||||
|
||||
/// The maximum number of seconds to wait before attempting to reconnect.
|
||||
var reconnectWaitMax: Int { get set }
|
||||
|
||||
/// The randomization factor for calculating reconnect jitter.
|
||||
var randomizationFactor: Double { get set }
|
||||
|
||||
/// The URL of the socket.io server.
|
||||
var socketURL: URL { get }
|
||||
|
||||
/// The status of this manager.
|
||||
var status: SocketIOStatus { get }
|
||||
|
||||
/// The version of socket.io in use.
|
||||
var version: SocketIOVersion { get }
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
/// Connects the underlying transport.
|
||||
func connect()
|
||||
|
||||
/// Connects a socket through this manager's engine.
|
||||
///
|
||||
/// - parameter socket: The socket who we should connect through this manager.
|
||||
/// - parameter withPayload: Optional payload to send on connect
|
||||
func connectSocket(_ socket: SocketIOClient, withPayload: [String: Any]?)
|
||||
|
||||
/// Called when the manager has disconnected from socket.io.
|
||||
///
|
||||
/// - parameter reason: The reason for the disconnection.
|
||||
func didDisconnect(reason: String)
|
||||
|
||||
/// Disconnects the manager and all associated sockets.
|
||||
func disconnect()
|
||||
|
||||
/// Disconnects the given socket.
|
||||
///
|
||||
/// - parameter socket: The socket to disconnect.
|
||||
func disconnectSocket(_ socket: SocketIOClient)
|
||||
|
||||
/// Disconnects the socket associated with `forNamespace`.
|
||||
///
|
||||
/// - parameter nsp: The namespace to disconnect from.
|
||||
func disconnectSocket(forNamespace nsp: String)
|
||||
|
||||
/// Sends an event to the server on all namespaces in this manager.
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The data to send with this event.
|
||||
func emitAll(_ event: String, _ items: SocketData...)
|
||||
|
||||
/// Tries to reconnect to the server.
|
||||
///
|
||||
/// This will cause a `disconnect` event to be emitted, as well as an `reconnectAttempt` event.
|
||||
func reconnect()
|
||||
|
||||
/// Removes the socket from the manager's control.
|
||||
/// After calling this method the socket should no longer be considered usable.
|
||||
///
|
||||
/// - parameter socket: The socket to remove.
|
||||
/// - returns: The socket removed, if it was owned by the manager.
|
||||
@discardableResult
|
||||
func removeSocket(_ socket: SocketIOClient) -> SocketIOClient?
|
||||
|
||||
/// Returns a `SocketIOClient` for the given namespace. This socket shares a transport with the manager.
|
||||
///
|
||||
/// Calling multiple times returns the same socket.
|
||||
///
|
||||
/// Sockets created from this method are retained by the manager.
|
||||
/// Call one of the `disconnectSocket` methods on the implementing class to remove the socket from manager control.
|
||||
/// Or call `SocketIOClient.disconnect()` on the client.
|
||||
///
|
||||
/// - parameter nsp: The namespace for the socket.
|
||||
/// - returns: A `SocketIOClient` for the given namespace.
|
||||
func socket(forNamespace nsp: String) -> SocketIOClient
|
||||
}
|
||||
@@ -25,42 +25,57 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
struct SocketPacket {
|
||||
enum PacketType: Int {
|
||||
case connect, disconnect, event, ack, error, binaryEvent, binaryAck
|
||||
}
|
||||
|
||||
private let placeholders: Int
|
||||
|
||||
/// A struct that represents a socket.io packet.
|
||||
public struct SocketPacket : CustomStringConvertible {
|
||||
// MARK: Properties
|
||||
|
||||
private static let logType = "SocketPacket"
|
||||
|
||||
let nsp: String
|
||||
let id: Int
|
||||
let type: PacketType
|
||||
|
||||
var binary: [Data]
|
||||
var data: [Any]
|
||||
var args: [Any] {
|
||||
/// The namespace for this packet.
|
||||
public let nsp: String
|
||||
|
||||
/// If > 0 then this packet is using acking.
|
||||
public let id: Int
|
||||
|
||||
/// The type of this packet.
|
||||
public let type: PacketType
|
||||
|
||||
/// An array of binary data for this packet.
|
||||
public internal(set) var binary: [Data]
|
||||
|
||||
/// The data for this event.
|
||||
///
|
||||
/// Note: This includes all data inside of the socket.io packet payload array, which includes the event name for
|
||||
/// event type packets.
|
||||
public internal(set) var data: [Any]
|
||||
|
||||
/// Returns the payload for this packet, minus the event name if this is an event or binaryEvent type packet.
|
||||
public var args: [Any] {
|
||||
if type == .event || type == .binaryEvent && data.count != 0 {
|
||||
return Array(data.dropFirst())
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
var description: String {
|
||||
|
||||
private let placeholders: Int
|
||||
|
||||
/// A string representation of this packet.
|
||||
public var description: String {
|
||||
return "SocketPacket {type: \(String(type.rawValue)); data: " +
|
||||
"\(String(describing: data)); id: \(id); placeholders: \(placeholders); nsp: \(nsp)}"
|
||||
}
|
||||
|
||||
var event: String {
|
||||
|
||||
/// The event name for this packet.
|
||||
public var event: String {
|
||||
return String(describing: data[0])
|
||||
}
|
||||
|
||||
var packetString: String {
|
||||
|
||||
/// A string representation of this packet.
|
||||
public var packetString: String {
|
||||
return createPacketString()
|
||||
}
|
||||
|
||||
|
||||
init(type: PacketType, data: [Any] = [Any](), id: Int = -1, nsp: String, placeholders: Int = 0,
|
||||
binary: [Data] = [Data]()) {
|
||||
self.data = data
|
||||
@@ -70,14 +85,14 @@ struct SocketPacket {
|
||||
self.placeholders = placeholders
|
||||
self.binary = binary
|
||||
}
|
||||
|
||||
|
||||
mutating func addData(_ data: Data) -> Bool {
|
||||
if placeholders == binary.count {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
binary.append(data)
|
||||
|
||||
|
||||
if placeholders == binary.count {
|
||||
fillInPlaceholders()
|
||||
return true
|
||||
@@ -85,41 +100,38 @@ struct SocketPacket {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func completeMessage(_ message: String) -> String {
|
||||
if data.count == 0 {
|
||||
return message + "[]"
|
||||
}
|
||||
|
||||
guard data.count != 0 else { return message + "[]" }
|
||||
guard let jsonSend = try? data.toJSON(), let jsonString = String(data: jsonSend, encoding: .utf8) else {
|
||||
DefaultSocketLogger.Logger.error("Error creating JSON object in SocketPacket.completeMessage",
|
||||
type: SocketPacket.logType)
|
||||
|
||||
|
||||
return message + "[]"
|
||||
}
|
||||
|
||||
|
||||
return message + jsonString
|
||||
}
|
||||
|
||||
|
||||
private func createPacketString() -> String {
|
||||
let typeString = String(type.rawValue)
|
||||
// Binary count?
|
||||
let binaryCountString = typeString + (type == .binaryEvent || type == .binaryAck ? "\(String(binary.count))-" : "")
|
||||
let binaryCountString = typeString + (type.isBinary ? "\(String(binary.count))-" : "")
|
||||
// Namespace?
|
||||
let nspString = binaryCountString + (nsp != "/" ? "\(nsp)," : "")
|
||||
// Ack number?
|
||||
let idString = nspString + (id != -1 ? String(id) : "")
|
||||
|
||||
|
||||
return completeMessage(idString)
|
||||
}
|
||||
|
||||
|
||||
// Called when we have all the binary data for a packet
|
||||
// calls _fillInPlaceholders, which replaces placeholders with the
|
||||
// corresponding binary
|
||||
private mutating func fillInPlaceholders() {
|
||||
data = data.map(_fillInPlaceholders)
|
||||
}
|
||||
|
||||
|
||||
// Helper method that looks for placeholders
|
||||
// If object is a collection it will recurse
|
||||
// Returns the object if it is not a placeholder or the corresponding
|
||||
@@ -130,12 +142,8 @@ struct SocketPacket {
|
||||
if dict["_placeholder"] as? Bool ?? false {
|
||||
return binary[dict["num"] as! Int]
|
||||
} else {
|
||||
return dict.reduce(JSON(), {cur, keyValue in
|
||||
var cur = cur
|
||||
|
||||
return dict.reduce(into: JSON(), {cur, keyValue in
|
||||
cur[keyValue.0] = _fillInPlaceholders(keyValue.1)
|
||||
|
||||
return cur
|
||||
})
|
||||
}
|
||||
case let arr as [Any]:
|
||||
@@ -146,6 +154,43 @@ struct SocketPacket {
|
||||
}
|
||||
}
|
||||
|
||||
public extension SocketPacket {
|
||||
// MARK: PacketType enum
|
||||
|
||||
/// The type of packets.
|
||||
enum PacketType: Int {
|
||||
// MARK: Cases
|
||||
|
||||
/// Connect: 0
|
||||
case connect
|
||||
|
||||
/// Disconnect: 1
|
||||
case disconnect
|
||||
|
||||
/// Event: 2
|
||||
case event
|
||||
|
||||
/// Ack: 3
|
||||
case ack
|
||||
|
||||
/// Error: 4
|
||||
case error
|
||||
|
||||
/// Binary Event: 5
|
||||
case binaryEvent
|
||||
|
||||
/// Binary Ack: 6
|
||||
case binaryAck
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// Whether or not this type is binary
|
||||
public var isBinary: Bool {
|
||||
return self == .binaryAck || self == .binaryEvent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension SocketPacket {
|
||||
private static func findType(_ binCount: Int, ack: Bool) -> PacketType {
|
||||
switch binCount {
|
||||
@@ -161,13 +206,16 @@ extension SocketPacket {
|
||||
return .error
|
||||
}
|
||||
}
|
||||
|
||||
static func packetFromEmit(_ items: [Any], id: Int, nsp: String, ack: Bool) -> SocketPacket {
|
||||
let (parsedData, binary) = deconstructData(items)
|
||||
let packet = SocketPacket(type: findType(binary.count, ack: ack), data: parsedData,
|
||||
id: id, nsp: nsp, binary: binary)
|
||||
|
||||
return packet
|
||||
|
||||
static func packetFromEmit(_ items: [Any], id: Int, nsp: String, ack: Bool, checkForBinary: Bool = true) -> SocketPacket {
|
||||
if checkForBinary {
|
||||
let (parsedData, binary) = deconstructData(items)
|
||||
|
||||
return SocketPacket(type: findType(binary.count, ack: ack), data: parsedData, id: id, nsp: nsp,
|
||||
binary: binary)
|
||||
} else {
|
||||
return SocketPacket(type: findType(0, ack: ack), data: items, id: id, nsp: nsp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,32 +223,28 @@ private extension SocketPacket {
|
||||
// Recursive function that looks for NSData in collections
|
||||
static func shred(_ data: Any, binary: inout [Data]) -> Any {
|
||||
let placeholder = ["_placeholder": true, "num": binary.count] as JSON
|
||||
|
||||
|
||||
switch data {
|
||||
case let bin as Data:
|
||||
binary.append(bin)
|
||||
|
||||
|
||||
return placeholder
|
||||
case let arr as [Any]:
|
||||
return arr.map({shred($0, binary: &binary)})
|
||||
case let dict as JSON:
|
||||
return dict.reduce(JSON(), {cur, keyValue in
|
||||
var mutCur = cur
|
||||
|
||||
mutCur[keyValue.0] = shred(keyValue.1, binary: &binary)
|
||||
|
||||
return mutCur
|
||||
return dict.reduce(into: JSON(), {cur, keyValue in
|
||||
cur[keyValue.0] = shred(keyValue.1, binary: &binary)
|
||||
})
|
||||
default:
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Removes binary data from emit data
|
||||
// Returns a type containing the de-binaryed data and the binary
|
||||
static func deconstructData(_ data: [Any]) -> ([Any], [Data]) {
|
||||
var binary = [Data]()
|
||||
|
||||
return (data.map({shred($0, binary: &binary)}), binary)
|
||||
|
||||
return (data.map({ shred($0, binary: &binary) }), binary)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
//
|
||||
// SocketParsable.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// 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.
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Defines that a type will be able to parse socket.io-protocol messages.
|
||||
public protocol SocketParsable : AnyObject {
|
||||
// MARK: Methods
|
||||
|
||||
/// Called when the engine has received some binary data that should be attached to a packet.
|
||||
///
|
||||
/// Packets binary data should be sent directly after the packet that expects it, so there's confusion over
|
||||
/// where the data should go. Data should be received in the order it is sent, so that the correct data is put
|
||||
/// into the correct placeholder.
|
||||
///
|
||||
/// - parameter data: The data that should be attached to a packet.
|
||||
func parseBinaryData(_ data: Data) -> SocketPacket?
|
||||
|
||||
/// Called when the engine has received a string that should be parsed into a socket.io packet.
|
||||
///
|
||||
/// - parameter message: The string that needs parsing.
|
||||
/// - returns: A completed socket packet if there is no more data left to collect.
|
||||
func parseSocketMessage(_ message: String) -> SocketPacket?
|
||||
}
|
||||
|
||||
/// Errors that can be thrown during parsing.
|
||||
public enum SocketParsableError : Error {
|
||||
// MARK: Cases
|
||||
|
||||
/// Thrown when a packet received has an invalid data array, or is missing the data array.
|
||||
case invalidDataArray
|
||||
|
||||
/// Thrown when an malformed packet is received.
|
||||
case invalidPacket
|
||||
|
||||
/// Thrown when the parser receives an unknown packet type.
|
||||
case invalidPacketType
|
||||
}
|
||||
|
||||
/// Says that a type will be able to buffer binary data before all data for an event has come in.
|
||||
public protocol SocketDataBufferable : AnyObject {
|
||||
// MARK: Properties
|
||||
|
||||
/// A list of packets that are waiting for binary data.
|
||||
///
|
||||
/// The way that socket.io works all data should be sent directly after each packet.
|
||||
/// So this should ideally be an array of one packet waiting for data.
|
||||
///
|
||||
/// **This should not be modified directly.**
|
||||
var waitingPackets: [SocketPacket] { get set }
|
||||
}
|
||||
|
||||
public extension SocketParsable where Self: SocketManagerSpec & SocketDataBufferable {
|
||||
/// Parses a message from the engine, returning a complete SocketPacket or throwing.
|
||||
///
|
||||
/// - parameter message: The message to parse.
|
||||
/// - returns: A completed packet, or throwing.
|
||||
internal func parseString(_ message: String) throws -> SocketPacket {
|
||||
var reader = SocketStringReader(message: message)
|
||||
|
||||
guard let type = Int(reader.read(count: 1)).flatMap({ SocketPacket.PacketType(rawValue: $0) }) else {
|
||||
throw SocketParsableError.invalidPacketType
|
||||
}
|
||||
|
||||
if !reader.hasNext {
|
||||
return SocketPacket(type: type, nsp: "/")
|
||||
}
|
||||
|
||||
var namespace = "/"
|
||||
var placeholders = -1
|
||||
|
||||
if type.isBinary {
|
||||
if let holders = Int(reader.readUntilOccurence(of: "-")) {
|
||||
placeholders = holders
|
||||
} else {
|
||||
throw SocketParsableError.invalidPacket
|
||||
}
|
||||
}
|
||||
|
||||
if reader.currentCharacter == "/" {
|
||||
namespace = reader.readUntilOccurence(of: ",")
|
||||
}
|
||||
|
||||
if !reader.hasNext {
|
||||
return SocketPacket(type: type, nsp: namespace, placeholders: placeholders)
|
||||
}
|
||||
|
||||
var idString = ""
|
||||
|
||||
if type == .error {
|
||||
reader.advance(by: -1)
|
||||
} else {
|
||||
while let int = Int(reader.read(count: 1)) {
|
||||
idString += String(int)
|
||||
}
|
||||
|
||||
reader.advance(by: -2)
|
||||
}
|
||||
|
||||
var dataArray = String(message.utf16[message.utf16.index(reader.currentIndex, offsetBy: 1)...])!
|
||||
|
||||
if (type == .error || type == .connect) && !dataArray.hasPrefix("[") && !dataArray.hasSuffix("]") {
|
||||
dataArray = "[" + dataArray + "]"
|
||||
}
|
||||
|
||||
let data = try parseData(dataArray)
|
||||
|
||||
return SocketPacket(type: type, data: data, id: Int(idString) ?? -1, nsp: namespace, placeholders: placeholders)
|
||||
}
|
||||
|
||||
// Parses data for events
|
||||
private func parseData(_ data: String) throws -> [Any] {
|
||||
do {
|
||||
return try data.toArray()
|
||||
} catch {
|
||||
throw SocketParsableError.invalidDataArray
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when the engine has received a string that should be parsed into a socket.io packet.
|
||||
///
|
||||
/// - parameter message: The string that needs parsing.
|
||||
/// - returns: A completed socket packet or nil if the packet is invalid.
|
||||
func parseSocketMessage(_ message: String) -> SocketPacket? {
|
||||
guard !message.isEmpty else { return nil }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Parsing \(message)", type: "SocketParser")
|
||||
|
||||
do {
|
||||
let packet = try parseString(message)
|
||||
|
||||
DefaultSocketLogger.Logger.log("Decoded packet as: \(packet.description)", type: "SocketParser")
|
||||
|
||||
return packet
|
||||
} catch {
|
||||
DefaultSocketLogger.Logger.error("\(error): \(message)", type: "SocketParser")
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when the engine has received some binary data that should be attached to a packet.
|
||||
///
|
||||
/// Packets binary data should be sent directly after the packet that expects it, so there's confusion over
|
||||
/// where the data should go. Data should be received in the order it is sent, so that the correct data is put
|
||||
/// into the correct placeholder.
|
||||
///
|
||||
/// - parameter data: The data that should be attached to a packet.
|
||||
/// - returns: A completed socket packet if there is no more data left to collect.
|
||||
func parseBinaryData(_ data: Data) -> SocketPacket? {
|
||||
guard !waitingPackets.isEmpty else {
|
||||
DefaultSocketLogger.Logger.error("Got data when not remaking packet", type: "SocketParser")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Should execute event?
|
||||
guard waitingPackets[waitingPackets.count - 1].addData(data) else { return nil }
|
||||
|
||||
return waitingPackets.removeLast()
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import Starscream
|
||||
|
||||
enum JSONError : Error {
|
||||
case notArray
|
||||
@@ -37,11 +38,11 @@ extension Array {
|
||||
|
||||
extension CharacterSet {
|
||||
static var allowedURLCharacterSet: CharacterSet {
|
||||
return CharacterSet(charactersIn: "!*'();:@&=+$,/?%#[]\" {}").inverted
|
||||
return CharacterSet(charactersIn: "!*'();:@&=+$,/?%#[]\" {}^|").inverted
|
||||
}
|
||||
}
|
||||
|
||||
extension NSDictionary {
|
||||
extension Dictionary where Key == String, Value == Any {
|
||||
private static func keyValueToSocketIOClientOption(key: String, value: Any) -> SocketIOClientOption? {
|
||||
switch (key, value) {
|
||||
case let ("connectParams", params as [String: Any]):
|
||||
@@ -62,8 +63,6 @@ extension NSDictionary {
|
||||
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):
|
||||
@@ -72,17 +71,25 @@ extension NSDictionary {
|
||||
return .reconnectAttempts(attempts)
|
||||
case let ("reconnectWait", wait as Int):
|
||||
return .reconnectWait(wait)
|
||||
case let ("reconnectWaitMax", wait as Int):
|
||||
return .reconnectWaitMax(wait)
|
||||
case let ("randomizationFactor", factor as Double):
|
||||
return .randomizationFactor(factor)
|
||||
case let ("secure", secure as Bool):
|
||||
return .secure(secure)
|
||||
case let ("security", security as SSLSecurity):
|
||||
case let ("security", security as CertificatePinning):
|
||||
return .security(security)
|
||||
case let ("selfSigned", selfSigned as Bool):
|
||||
return .selfSigned(selfSigned)
|
||||
case let ("sessionDelegate", delegate as URLSessionDelegate):
|
||||
return .sessionDelegate(delegate)
|
||||
case let ("voipEnabled", enable as Bool):
|
||||
return .voipEnabled(enable)
|
||||
default:
|
||||
case let ("compress", compress as Bool):
|
||||
return compress ? .compress : nil
|
||||
case let ("enableSOCKSProxy", enable as Bool):
|
||||
return .enableSOCKSProxy(enable)
|
||||
case let ("version", version as Int):
|
||||
return .version(SocketIOVersion(rawValue: version) ?? .three)
|
||||
case _:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -91,7 +98,7 @@ extension NSDictionary {
|
||||
var options = [] as SocketIOClientConfiguration
|
||||
|
||||
for (rawKey, value) in self {
|
||||
if let key = rawKey as? String, let opt = NSDictionary.keyValueToSocketIOClientOption(key: key, value: value) {
|
||||
if let opt = Dictionary.keyValueToSocketIOClientOption(key: rawKey, value: value) {
|
||||
options.insert(opt)
|
||||
}
|
||||
}
|
||||
@@ -110,9 +117,9 @@ extension String {
|
||||
return array
|
||||
}
|
||||
|
||||
func toNSDictionary() throws -> NSDictionary {
|
||||
func toDictionary() throws -> [String: Any] {
|
||||
guard let binData = data(using: .utf16, allowLossyConversion: false) else { return [:] }
|
||||
guard let json = try JSONSerialization.jsonObject(with: binData, options: .allowFragments) as? NSDictionary else {
|
||||
guard let json = try JSONSerialization.jsonObject(with: binData, options: .allowFragments) as? [String: Any] else {
|
||||
throw JSONError.notNSDictionary
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
import Foundation
|
||||
|
||||
/// Represents a class will log client events.
|
||||
public protocol SocketLogger : class {
|
||||
public protocol SocketLogger : AnyObject {
|
||||
// MARK: Properties
|
||||
|
||||
/// Whether to log or not
|
||||
@@ -38,34 +38,33 @@ public protocol SocketLogger : class {
|
||||
/// - parameter message: The message being logged. Can include `%@` that will be replaced with `args`
|
||||
/// - parameter type: The type of entity that called for logging.
|
||||
/// - parameter args: Any args that should be inserted into the message. May be left out.
|
||||
func log(_ message: String, type: String, args: Any...)
|
||||
func log(_ message: @autoclosure () -> String, type: String)
|
||||
|
||||
/// Error Messages
|
||||
///
|
||||
/// - parameter message: The message being logged. Can include `%@` that will be replaced with `args`
|
||||
/// - parameter type: The type of entity that called for logging.
|
||||
/// - parameter args: Any args that should be inserted into the message. May be left out.
|
||||
func error(_ message: String, type: String, args: Any...)
|
||||
func error(_ message: @autoclosure () -> String, type: String)
|
||||
}
|
||||
|
||||
public extension SocketLogger {
|
||||
/// Default implementation.
|
||||
func log(_ message: String, type: String, args: Any...) {
|
||||
abstractLog("LOG", message: message, type: type, args: args)
|
||||
func log(_ message: @autoclosure () -> String, type: String) {
|
||||
guard log else { return }
|
||||
|
||||
abstractLog("LOG", message: message(), type: type)
|
||||
}
|
||||
|
||||
/// Default implementation.
|
||||
func error(_ message: String, type: String, args: Any...) {
|
||||
abstractLog("ERROR", message: message, type: type, args: args)
|
||||
}
|
||||
|
||||
private func abstractLog(_ logType: String, message: String, type: String, args: [Any]) {
|
||||
func error(_ message: @autoclosure () -> String, type: String) {
|
||||
guard log else { return }
|
||||
|
||||
let newArgs = args.map({arg -> CVarArg in String(describing: arg)})
|
||||
let messageFormat = String(format: message, arguments: newArgs)
|
||||
abstractLog("ERROR", message: message(), type: type)
|
||||
}
|
||||
|
||||
NSLog("\(logType) \(type): %@", messageFormat)
|
||||
private func abstractLog(_ logType: String, message: @autoclosure () -> String, type: String) {
|
||||
NSLog("\(logType) \(type): %@", message())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@ struct SocketStringReader {
|
||||
}
|
||||
|
||||
mutating func readUntilOccurence(of string: String) -> String {
|
||||
let substring = message.utf16[currentIndex..<message.utf16.endIndex]
|
||||
let substring = message.utf16[currentIndex...]
|
||||
|
||||
guard let foundIndex = substring.index(of: string.utf16.first!) else {
|
||||
guard let foundIndex = substring.firstIndex(where: { $0 == string.utf16.first! }) else {
|
||||
currentIndex = message.utf16.endIndex
|
||||
|
||||
return String(substring)!
|
||||
@@ -73,8 +73,11 @@ public typealias AckCallback = ([Any]) -> ()
|
||||
/// A typealias for a normal callback.
|
||||
public typealias NormalCallback = ([Any], SocketAckEmitter) -> ()
|
||||
|
||||
/// A typealias for a queued POST
|
||||
public typealias Post = (msg: String, completion: (() -> ())?)
|
||||
|
||||
typealias JSON = [String: Any]
|
||||
typealias Probe = (msg: String, type: SocketEnginePacketType, data: [Data])
|
||||
typealias Probe = (msg: String, type: SocketEnginePacketType, data: [Data], completion: (() -> ())?)
|
||||
typealias ProbeWaitQueue = [Probe]
|
||||
|
||||
enum Either<E, V> {
|
||||
@@ -1,608 +0,0 @@
|
||||
//
|
||||
// SocketIOClient.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 11/23/14.
|
||||
//
|
||||
// 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.
|
||||
|
||||
import Dispatch
|
||||
import Foundation
|
||||
|
||||
/// The main class for SocketIOClientSwift.
|
||||
///
|
||||
/// **NOTE**: The client is not thread/queue safe, all interaction with the socket should be done on the `handleQueue`
|
||||
///
|
||||
/// Represents a socket.io-client. Most interaction with socket.io will be through this class.
|
||||
open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, SocketParsable {
|
||||
// MARK: Properties
|
||||
|
||||
/// The engine for this client.
|
||||
public private(set) var engine: SocketEngineSpec?
|
||||
|
||||
/// The status of this client.
|
||||
public private(set) var status = SocketIOClientStatus.notConnected {
|
||||
didSet {
|
||||
switch status {
|
||||
case .connected:
|
||||
reconnecting = false
|
||||
currentReconnectAttempt = 0
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
handleClientEvent(.statusChange, data: [status])
|
||||
}
|
||||
}
|
||||
|
||||
/// If `true` then every time `connect` is called, a new engine will be created.
|
||||
public var forceNew = false
|
||||
|
||||
/// The queue that all interaction with the client should occur on. This is the queue that event handlers are
|
||||
/// called on.
|
||||
public var handleQueue = DispatchQueue.main
|
||||
|
||||
/// The namespace for this client.
|
||||
public var nsp = "/"
|
||||
|
||||
/// The configuration for this client.
|
||||
public var config: SocketIOClientConfiguration
|
||||
|
||||
/// If `true`, this client will try and reconnect on any disconnects.
|
||||
public var reconnects = true
|
||||
|
||||
/// The number of seconds to wait before attempting to reconnect.
|
||||
public var reconnectWait = 10
|
||||
|
||||
/// The session id of this client.
|
||||
public var sid: String? {
|
||||
return engine?.sid
|
||||
}
|
||||
|
||||
/// The URL of the socket.io server.
|
||||
///
|
||||
/// If changed after calling `init`, `forceNew` must be set to `true`, or it will only connect to the url set in the
|
||||
/// init.
|
||||
public var socketURL: URL
|
||||
|
||||
var ackHandlers = SocketAckManager()
|
||||
var waitingPackets = [SocketPacket]()
|
||||
|
||||
private(set) var currentAck = -1
|
||||
private(set) var reconnectAttempts = -1
|
||||
|
||||
private let logType = "SocketIOClient"
|
||||
|
||||
private var anyHandler: ((SocketAnyEvent) -> ())?
|
||||
private var currentReconnectAttempt = 0
|
||||
private var handlers = [SocketEventHandler]()
|
||||
private var reconnecting = false
|
||||
|
||||
// MARK: Initializers
|
||||
|
||||
/// Type safe way to create a new SocketIOClient. `opts` can be omitted.
|
||||
///
|
||||
/// - parameter socketURL: The url of the socket.io server.
|
||||
/// - parameter config: The config for this socket.
|
||||
public init(socketURL: URL, config: SocketIOClientConfiguration = []) {
|
||||
self.config = config
|
||||
self.socketURL = socketURL
|
||||
|
||||
if socketURL.absoluteString.hasPrefix("https://") {
|
||||
self.config.insert(.secure(true))
|
||||
}
|
||||
|
||||
for option in config {
|
||||
switch option {
|
||||
case let .reconnects(reconnects):
|
||||
self.reconnects = reconnects
|
||||
case let .reconnectAttempts(attempts):
|
||||
reconnectAttempts = attempts
|
||||
case let .reconnectWait(wait):
|
||||
reconnectWait = abs(wait)
|
||||
case let .nsp(nsp):
|
||||
self.nsp = nsp
|
||||
case let .log(log):
|
||||
DefaultSocketLogger.Logger.log = log
|
||||
case let .logger(logger):
|
||||
DefaultSocketLogger.Logger = logger
|
||||
case let .handleQueue(queue):
|
||||
handleQueue = queue
|
||||
case let .forceNew(force):
|
||||
forceNew = force
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
self.config.insert(.path("/socket.io/"), replacing: false)
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
/// 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>)`
|
||||
///
|
||||
/// - parameter socketURL: The url of the socket.io server.
|
||||
/// - parameter config: The config for this socket.
|
||||
public convenience init(socketURL: NSURL, config: NSDictionary?) {
|
||||
self.init(socketURL: socketURL as URL, config: config?.toSocketConfiguration() ?? [])
|
||||
}
|
||||
|
||||
deinit {
|
||||
DefaultSocketLogger.Logger.log("Client is being released", type: logType)
|
||||
engine?.disconnect(reason: "Client Deinit")
|
||||
}
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
private func addEngine() {
|
||||
DefaultSocketLogger.Logger.log("Adding engine", type: logType, args: "")
|
||||
|
||||
engine?.client = nil
|
||||
engine = SocketEngine(client: self, url: socketURL, config: config)
|
||||
}
|
||||
|
||||
/// Connect to the server.
|
||||
open func connect() {
|
||||
connect(timeoutAfter: 0, withHandler: nil)
|
||||
}
|
||||
|
||||
/// Connect to the server. If we aren't connected after `timeoutAfter` seconds, then `withHandler` is called.
|
||||
///
|
||||
/// - parameter timeoutAfter: The number of seconds after which if we are not connected we assume the connection
|
||||
/// has failed. Pass 0 to never timeout.
|
||||
/// - parameter withHandler: The handler to call when the client fails to connect.
|
||||
open func connect(timeoutAfter: Int, withHandler handler: (() -> ())?) {
|
||||
assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)")
|
||||
|
||||
guard status != .connected else {
|
||||
DefaultSocketLogger.Logger.log("Tried connecting on an already connected socket", type: logType)
|
||||
return
|
||||
}
|
||||
|
||||
status = .connecting
|
||||
|
||||
if engine == nil || forceNew {
|
||||
addEngine()
|
||||
}
|
||||
|
||||
engine?.connect()
|
||||
|
||||
guard timeoutAfter != 0 else { return }
|
||||
|
||||
handleQueue.asyncAfter(deadline: DispatchTime.now() + Double(timeoutAfter)) {[weak self] in
|
||||
guard let this = self, this.status == .connecting || this.status == .notConnected else { return }
|
||||
|
||||
this.status = .disconnected
|
||||
this.engine?.disconnect(reason: "Connect timeout")
|
||||
|
||||
handler?()
|
||||
}
|
||||
}
|
||||
|
||||
private func createOnAck(_ items: [Any]) -> OnAckCallback {
|
||||
currentAck += 1
|
||||
|
||||
return OnAckCallback(ackNumber: currentAck, items: items, socket: self)
|
||||
}
|
||||
|
||||
func didConnect() {
|
||||
DefaultSocketLogger.Logger.log("Socket connected", type: logType)
|
||||
|
||||
status = .connected
|
||||
|
||||
handleClientEvent(.connect, data: [])
|
||||
}
|
||||
|
||||
func didDisconnect(reason: String) {
|
||||
guard status != .disconnected else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Disconnected: %@", type: logType, args: reason)
|
||||
|
||||
reconnecting = false
|
||||
status = .disconnected
|
||||
|
||||
// Make sure the engine is actually dead.
|
||||
engine?.disconnect(reason: reason)
|
||||
handleClientEvent(.disconnect, data: [reason])
|
||||
}
|
||||
|
||||
/// Disconnects the socket.
|
||||
open func disconnect() {
|
||||
DefaultSocketLogger.Logger.log("Closing socket", type: logType)
|
||||
|
||||
didDisconnect(reason: "Disconnect")
|
||||
}
|
||||
|
||||
/// Send an event to the server, with optional data items.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
open func emit(_ event: String, _ items: SocketData...) {
|
||||
do {
|
||||
try emit(event, with: items.map({ try $0.socketRepresentation() }))
|
||||
} catch let err {
|
||||
DefaultSocketLogger.Logger.error("Error creating socketRepresentation for emit: \(event), \(items)",
|
||||
type: logType)
|
||||
|
||||
handleClientEvent(.error, data: [event, items, err])
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as emit, but meant for Objective-C
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter with: The items to send with this event. May be left out.
|
||||
open func emit(_ event: String, with items: [Any]) {
|
||||
guard status == .connected else {
|
||||
handleClientEvent(.error, data: ["Tried emitting \(event) when not connected"])
|
||||
return
|
||||
}
|
||||
|
||||
_emit([event] + items)
|
||||
}
|
||||
|
||||
/// Sends a message to the server, requesting an ack.
|
||||
///
|
||||
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
/// Check that your server's api will ack the event being sent.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter items: The items to send with this event. May be left out.
|
||||
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
|
||||
open func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback {
|
||||
do {
|
||||
return emitWithAck(event, with: try items.map({ try $0.socketRepresentation() }))
|
||||
} catch let err {
|
||||
DefaultSocketLogger.Logger.error("Error creating socketRepresentation for emit: \(event), \(items)",
|
||||
type: logType)
|
||||
|
||||
handleClientEvent(.error, data: [event, items, err])
|
||||
|
||||
return OnAckCallback(ackNumber: -1, items: [], socket: self)
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as emitWithAck, but for Objective-C
|
||||
///
|
||||
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
/// Check that your server's api will ack the event being sent.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.emitWithAck("myEvent", with: [1]).timingOut(after: 1) {data in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event to send.
|
||||
/// - parameter with: The items to send with this event. Use `[]` to send nothing.
|
||||
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
|
||||
open func emitWithAck(_ event: String, with items: [Any]) -> OnAckCallback {
|
||||
return createOnAck([event] + items)
|
||||
}
|
||||
|
||||
func _emit(_ data: [Any], ack: Int? = nil) {
|
||||
guard status == .connected else {
|
||||
handleClientEvent(.error, data: ["Tried emitting when not connected"])
|
||||
return
|
||||
}
|
||||
|
||||
let packet = SocketPacket.packetFromEmit(data, id: ack ?? -1, nsp: nsp, ack: false)
|
||||
let str = packet.packetString
|
||||
|
||||
DefaultSocketLogger.Logger.log("Emitting: %@", type: logType, args: str)
|
||||
|
||||
engine?.send(str, withData: packet.binary)
|
||||
}
|
||||
|
||||
// If the server wants to know that the client received data
|
||||
func emitAck(_ ack: Int, with items: [Any]) {
|
||||
guard status == .connected else { return }
|
||||
|
||||
let packet = SocketPacket.packetFromEmit(items, id: ack, nsp: nsp, ack: true)
|
||||
let str = packet.packetString
|
||||
|
||||
DefaultSocketLogger.Logger.log("Emitting Ack: %@", type: logType, args: str)
|
||||
|
||||
engine?.send(str, withData: packet.binary)
|
||||
}
|
||||
|
||||
/// Called when the engine closes.
|
||||
///
|
||||
/// - parameter reason: The reason that the engine closed.
|
||||
open func engineDidClose(reason: String) {
|
||||
handleQueue.async {
|
||||
self._engineDidClose(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
private func _engineDidClose(reason: String) {
|
||||
waitingPackets.removeAll()
|
||||
|
||||
if status != .disconnected {
|
||||
status = .notConnected
|
||||
}
|
||||
|
||||
if status == .disconnected || !reconnects {
|
||||
didDisconnect(reason: reason)
|
||||
} else if !reconnecting {
|
||||
reconnecting = true
|
||||
tryReconnect(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when the engine errors.
|
||||
///
|
||||
/// - parameter reason: The reason the engine errored.
|
||||
open func engineDidError(reason: String) {
|
||||
handleQueue.async {
|
||||
self._engineDidError(reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
private func _engineDidError(reason: String) {
|
||||
DefaultSocketLogger.Logger.error("%@", type: logType, args: reason)
|
||||
|
||||
handleClientEvent(.error, data: [reason])
|
||||
}
|
||||
|
||||
/// Called when the engine opens.
|
||||
///
|
||||
/// - parameter reason: The reason the engine opened.
|
||||
open func engineDidOpen(reason: String) {
|
||||
DefaultSocketLogger.Logger.log(reason, type: "SocketEngineClient")
|
||||
}
|
||||
|
||||
// Called when the socket gets an ack for something it sent
|
||||
func handleAck(_ ack: Int, data: [Any]) {
|
||||
guard status == .connected else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Handling ack: %@ with data: %@", type: logType, args: ack, data)
|
||||
|
||||
ackHandlers.executeAck(ack, with: data, onQueue: handleQueue)
|
||||
}
|
||||
|
||||
/// Causes an event to be handled, and any event handlers for that event to be called.
|
||||
///
|
||||
/// - parameter event: The event that is to be handled.
|
||||
/// - parameter data: the data associated with this event.
|
||||
/// - parameter isInternalMessage: If `true` event handlers for this event will be called regardless of status.
|
||||
/// - parameter withAck: The ack number for this event. May be left out.
|
||||
open func handleEvent(_ event: String, data: [Any], isInternalMessage: Bool, withAck ack: Int = -1) {
|
||||
guard status == .connected || isInternalMessage else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Handling event: %@ with data: %@", type: logType, args: event, data)
|
||||
|
||||
anyHandler?(SocketAnyEvent(event: event, items: data))
|
||||
|
||||
for handler in handlers where handler.event == event {
|
||||
handler.executeCallback(with: data, withAck: ack, withSocket: self)
|
||||
}
|
||||
}
|
||||
|
||||
func handleClientEvent(_ event: SocketClientEvent, data: [Any]) {
|
||||
handleEvent(event.rawValue, data: data, isInternalMessage: true)
|
||||
}
|
||||
|
||||
/// Leaves nsp and goes back to the default namespace.
|
||||
open func leaveNamespace() {
|
||||
if nsp != "/" {
|
||||
engine?.send("1\(nsp)", withData: [])
|
||||
nsp = "/"
|
||||
}
|
||||
}
|
||||
|
||||
/// Joins `namespace`.
|
||||
///
|
||||
/// **Do not use this to join the default namespace.** Instead call `leaveNamespace`.
|
||||
///
|
||||
/// - parameter namespace: The namespace to join.
|
||||
open func joinNamespace(_ namespace: String) {
|
||||
nsp = namespace
|
||||
|
||||
if nsp != "/" {
|
||||
DefaultSocketLogger.Logger.log("Joining namespace", type: logType)
|
||||
engine?.send("0\(nsp)", withData: [])
|
||||
}
|
||||
}
|
||||
|
||||
/// Removes handler(s) based on an event name.
|
||||
///
|
||||
/// If you wish to remove a specific event, call the `off(id:)` with the UUID received from its `on` call.
|
||||
///
|
||||
/// - parameter event: The event to remove handlers for.
|
||||
open func off(_ event: String) {
|
||||
DefaultSocketLogger.Logger.log("Removing handler for event: %@", type: logType, args: event)
|
||||
|
||||
handlers = handlers.filter({ $0.event != event })
|
||||
}
|
||||
|
||||
/// Removes a handler with the specified UUID gotten from an `on` or `once`
|
||||
///
|
||||
/// If you want to remove all events for an event, call the off `off(_:)` method with the event name.
|
||||
///
|
||||
/// - parameter id: The UUID of the handler you wish to remove.
|
||||
open func off(id: UUID) {
|
||||
DefaultSocketLogger.Logger.log("Removing handler with id: %@", type: logType, args: id)
|
||||
|
||||
handlers = handlers.filter({ $0.id != id })
|
||||
}
|
||||
|
||||
/// Adds a handler for an event.
|
||||
///
|
||||
/// - parameter event: The event name for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
@discardableResult
|
||||
open func on(_ event: String, callback: @escaping NormalCallback) -> UUID {
|
||||
DefaultSocketLogger.Logger.log("Adding handler for event: %@", type: logType, args: event)
|
||||
|
||||
let handler = SocketEventHandler(event: event, id: UUID(), callback: callback)
|
||||
handlers.append(handler)
|
||||
|
||||
return handler.id
|
||||
}
|
||||
|
||||
/// Adds a handler for a client event.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```swift
|
||||
/// socket.on(clientEvent: .connect) {data, ack in
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter event: The event for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
@discardableResult
|
||||
open func on(clientEvent event: SocketClientEvent, callback: @escaping NormalCallback) -> UUID {
|
||||
DefaultSocketLogger.Logger.log("Adding handler for event: %@", type: logType, args: event)
|
||||
|
||||
let handler = SocketEventHandler(event: event.rawValue, id: UUID(), callback: callback)
|
||||
handlers.append(handler)
|
||||
|
||||
return handler.id
|
||||
}
|
||||
|
||||
/// Adds a single-use handler for an event.
|
||||
///
|
||||
/// - parameter event: The event name for this handler.
|
||||
/// - parameter callback: The callback that will execute when this event is received.
|
||||
/// - returns: A unique id for the handler that can be used to remove it.
|
||||
@discardableResult
|
||||
open func once(_ event: String, callback: @escaping NormalCallback) -> UUID {
|
||||
DefaultSocketLogger.Logger.log("Adding once handler for event: %@", type: logType, args: event)
|
||||
|
||||
let id = UUID()
|
||||
|
||||
let handler = SocketEventHandler(event: event, id: id) {[weak self] data, ack in
|
||||
guard let this = self else { return }
|
||||
this.off(id: id)
|
||||
callback(data, ack)
|
||||
}
|
||||
|
||||
handlers.append(handler)
|
||||
|
||||
return handler.id
|
||||
}
|
||||
|
||||
/// Adds a handler that will be called on every event.
|
||||
///
|
||||
/// - parameter handler: The callback that will execute whenever an event is received.
|
||||
open func onAny(_ handler: @escaping (SocketAnyEvent) -> ()) {
|
||||
anyHandler = handler
|
||||
}
|
||||
|
||||
/// Called when the engine has a message that must be parsed.
|
||||
///
|
||||
/// - parameter msg: The message that needs parsing.
|
||||
public func parseEngineMessage(_ msg: String) {
|
||||
DefaultSocketLogger.Logger.log("Should parse message: %@", type: "SocketIOClient", args: msg)
|
||||
|
||||
handleQueue.async { self.parseSocketMessage(msg) }
|
||||
}
|
||||
|
||||
/// Called when the engine receives binary data.
|
||||
///
|
||||
/// - parameter data: The data the engine received.
|
||||
public func parseEngineBinaryData(_ data: Data) {
|
||||
handleQueue.async { self.parseBinaryData(data) }
|
||||
}
|
||||
|
||||
/// Tries to reconnect to the server.
|
||||
///
|
||||
/// This will cause a `disconnect` event to be emitted, as well as an `reconnectAttempt` event.
|
||||
open func reconnect() {
|
||||
guard !reconnecting else { return }
|
||||
|
||||
engine?.disconnect(reason: "manual reconnect")
|
||||
}
|
||||
|
||||
/// Removes all handlers.
|
||||
/// Can be used after disconnecting to break any potential remaining retain cycles.
|
||||
open func removeAllHandlers() {
|
||||
handlers.removeAll(keepingCapacity: false)
|
||||
}
|
||||
|
||||
private func tryReconnect(reason: String) {
|
||||
guard reconnecting else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Starting reconnect", type: logType)
|
||||
handleClientEvent(.reconnect, data: [reason])
|
||||
|
||||
_tryReconnect()
|
||||
}
|
||||
|
||||
private func _tryReconnect() {
|
||||
guard reconnects && reconnecting && status != .disconnected else { return }
|
||||
|
||||
if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts {
|
||||
return didDisconnect(reason: "Reconnect Failed")
|
||||
}
|
||||
|
||||
DefaultSocketLogger.Logger.log("Trying to reconnect", type: logType)
|
||||
handleClientEvent(.reconnectAttempt, data: [(reconnectAttempts - currentReconnectAttempt)])
|
||||
|
||||
currentReconnectAttempt += 1
|
||||
connect()
|
||||
|
||||
handleQueue.asyncAfter(deadline: DispatchTime.now() + Double(reconnectWait), execute: _tryReconnect)
|
||||
}
|
||||
|
||||
// Test properties
|
||||
|
||||
var testHandlers: [SocketEventHandler] {
|
||||
return handlers
|
||||
}
|
||||
|
||||
func setTestable() {
|
||||
status = .connected
|
||||
}
|
||||
|
||||
func setTestStatus(_ status: SocketIOClientStatus) {
|
||||
self.status = status
|
||||
}
|
||||
|
||||
func setTestEngine(_ engine: SocketEngineSpec?) {
|
||||
self.engine = engine
|
||||
}
|
||||
|
||||
func emitTest(event: String, _ data: Any...) {
|
||||
_emit([event] + data)
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
//
|
||||
// SocketIOClientSpec.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 1/3/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.
|
||||
|
||||
import Dispatch
|
||||
|
||||
protocol SocketIOClientSpec : class {
|
||||
var handleQueue: DispatchQueue { get set }
|
||||
var nsp: String { get set }
|
||||
var waitingPackets: [SocketPacket] { get set }
|
||||
|
||||
func didConnect()
|
||||
func didDisconnect(reason: String)
|
||||
func didError(reason: String)
|
||||
func handleAck(_ ack: Int, data: [Any])
|
||||
func handleEvent(_ event: String, data: [Any], isInternalMessage: Bool, withAck ack: Int)
|
||||
func handleClientEvent(_ event: SocketClientEvent, data: [Any])
|
||||
func joinNamespace(_ namespace: String)
|
||||
}
|
||||
|
||||
extension SocketIOClientSpec {
|
||||
func didError(reason: String) {
|
||||
DefaultSocketLogger.Logger.error("%@", type: "SocketIOClient", args: reason)
|
||||
|
||||
handleClientEvent(.error, data: [reason])
|
||||
}
|
||||
}
|
||||
|
||||
/// The set of events that are generated by the client.
|
||||
public enum SocketClientEvent : String {
|
||||
/// Emitted when the client connects. This is also called on a successful reconnection.
|
||||
case connect
|
||||
|
||||
/// Called when the socket has disconnected and will not attempt to try to reconnect.
|
||||
case disconnect
|
||||
|
||||
/// Called when an error occurs.
|
||||
case error
|
||||
|
||||
/// Called when the client begins the reconnection process.
|
||||
case reconnect
|
||||
|
||||
/// Called each time the client tries to reconnect to the server.
|
||||
case reconnectAttempt
|
||||
|
||||
/// Called every time there is a change in the client's status.
|
||||
case statusChange
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
//
|
||||
// SocketParsable.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// 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.
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol SocketParsable {
|
||||
func parseBinaryData(_ data: Data)
|
||||
func parseSocketMessage(_ message: String)
|
||||
}
|
||||
|
||||
extension SocketParsable where Self: SocketIOClientSpec {
|
||||
private func isCorrectNamespace(_ nsp: String) -> Bool {
|
||||
return nsp == self.nsp
|
||||
}
|
||||
|
||||
private func handleConnect(_ packetNamespace: String) {
|
||||
if packetNamespace == "/" && nsp != "/" {
|
||||
joinNamespace(nsp)
|
||||
} else {
|
||||
didConnect()
|
||||
}
|
||||
}
|
||||
|
||||
private func handlePacket(_ pack: SocketPacket) {
|
||||
switch pack.type {
|
||||
case .event where isCorrectNamespace(pack.nsp):
|
||||
handleEvent(pack.event, data: pack.args, isInternalMessage: false, withAck: pack.id)
|
||||
case .ack where isCorrectNamespace(pack.nsp):
|
||||
handleAck(pack.id, data: pack.data)
|
||||
case .binaryEvent where isCorrectNamespace(pack.nsp):
|
||||
waitingPackets.append(pack)
|
||||
case .binaryAck where isCorrectNamespace(pack.nsp):
|
||||
waitingPackets.append(pack)
|
||||
case .connect:
|
||||
handleConnect(pack.nsp)
|
||||
case .disconnect:
|
||||
didDisconnect(reason: "Got Disconnect")
|
||||
case .error:
|
||||
handleEvent("error", data: pack.data, isInternalMessage: true, withAck: pack.id)
|
||||
default:
|
||||
DefaultSocketLogger.Logger.log("Got invalid packet: %@", type: "SocketParser", args: pack.description)
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses a messsage from the engine. Returning either a string error or a complete SocketPacket
|
||||
func parseString(_ message: String) -> Either<String, SocketPacket> {
|
||||
var reader = SocketStringReader(message: message)
|
||||
|
||||
guard let type = Int(reader.read(count: 1)).flatMap({ SocketPacket.PacketType(rawValue: $0) }) else {
|
||||
return .left("Invalid packet type")
|
||||
}
|
||||
|
||||
if !reader.hasNext {
|
||||
return .right(SocketPacket(type: type, nsp: "/"))
|
||||
}
|
||||
|
||||
var namespace = "/"
|
||||
var placeholders = -1
|
||||
|
||||
if type == .binaryEvent || type == .binaryAck {
|
||||
if let holders = Int(reader.readUntilOccurence(of: "-")) {
|
||||
placeholders = holders
|
||||
} else {
|
||||
return .left("Invalid packet")
|
||||
}
|
||||
}
|
||||
|
||||
if reader.currentCharacter == "/" {
|
||||
namespace = reader.readUntilOccurence(of: ",")
|
||||
}
|
||||
|
||||
if !reader.hasNext {
|
||||
return .right(SocketPacket(type: type, nsp: namespace, placeholders: placeholders))
|
||||
}
|
||||
|
||||
var idString = ""
|
||||
|
||||
if type == .error {
|
||||
reader.advance(by: -1)
|
||||
} else {
|
||||
while reader.hasNext {
|
||||
if let int = Int(reader.read(count: 1)) {
|
||||
idString += String(int)
|
||||
} else {
|
||||
reader.advance(by: -2)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var dataArray = String(message.utf16[message.utf16.index(reader.currentIndex, offsetBy: 1)..<message.utf16.endIndex])!
|
||||
|
||||
if type == .error && !dataArray.hasPrefix("[") && !dataArray.hasSuffix("]") {
|
||||
dataArray = "[" + dataArray + "]"
|
||||
}
|
||||
|
||||
switch parseData(dataArray) {
|
||||
case let .left(err):
|
||||
return .left(err)
|
||||
case let .right(data):
|
||||
return .right(SocketPacket(type: type, data: data, id: Int(idString) ?? -1,
|
||||
nsp: namespace, placeholders: placeholders))
|
||||
}
|
||||
}
|
||||
|
||||
// Parses data for events
|
||||
private func parseData(_ data: String) -> Either<String, [Any]> {
|
||||
do {
|
||||
return .right(try data.toArray())
|
||||
} catch {
|
||||
return .left("Error parsing data for packet")
|
||||
}
|
||||
}
|
||||
|
||||
// Parses messages recieved
|
||||
func parseSocketMessage(_ message: String) {
|
||||
guard !message.isEmpty else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Parsing %@", type: "SocketParser", args: message)
|
||||
|
||||
switch parseString(message) {
|
||||
case let .left(err):
|
||||
DefaultSocketLogger.Logger.error("\(err): %@", type: "SocketParser", args: message)
|
||||
case let .right(pack):
|
||||
DefaultSocketLogger.Logger.log("Decoded packet as: %@", type: "SocketParser", args: pack.description)
|
||||
handlePacket(pack)
|
||||
}
|
||||
}
|
||||
|
||||
func parseBinaryData(_ data: Data) {
|
||||
guard !waitingPackets.isEmpty else {
|
||||
DefaultSocketLogger.Logger.error("Got data when not remaking packet", type: "SocketParser")
|
||||
return
|
||||
}
|
||||
|
||||
// Should execute event?
|
||||
guard waitingPackets[waitingPackets.count - 1].addData(data) else { return }
|
||||
|
||||
let packet = waitingPackets.removeLast()
|
||||
|
||||
if packet.type != .binaryAck {
|
||||
handleEvent(packet.event, data: packet.args, isInternalMessage: false, withAck: packet.id)
|
||||
} else {
|
||||
handleAck(packet.id, data: packet.args)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,955 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Websocket.swift
|
||||
//
|
||||
// Created by Dalton Cherry on 7/16/14.
|
||||
// Copyright (c) 2014-2016 Dalton Cherry.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
import Foundation
|
||||
import CoreFoundation
|
||||
import Security
|
||||
|
||||
public let WebsocketDidConnectNotification = "WebsocketDidConnectNotification"
|
||||
public let WebsocketDidDisconnectNotification = "WebsocketDidDisconnectNotification"
|
||||
public let WebsocketDisconnectionErrorKeyName = "WebsocketDisconnectionErrorKeyName"
|
||||
|
||||
public protocol WebSocketDelegate: class {
|
||||
func websocketDidConnect(socket: WebSocket)
|
||||
func websocketDidDisconnect(socket: WebSocket, error: NSError?)
|
||||
func websocketDidReceiveMessage(socket: WebSocket, text: String)
|
||||
func websocketDidReceiveData(socket: WebSocket, data: Data)
|
||||
}
|
||||
|
||||
public protocol WebSocketPongDelegate: class {
|
||||
func websocketDidReceivePong(socket: WebSocket, data: Data?)
|
||||
}
|
||||
|
||||
open class WebSocket : NSObject, StreamDelegate {
|
||||
|
||||
enum OpCode : UInt8 {
|
||||
case continueFrame = 0x0
|
||||
case textFrame = 0x1
|
||||
case binaryFrame = 0x2
|
||||
// 3-7 are reserved.
|
||||
case connectionClose = 0x8
|
||||
case ping = 0x9
|
||||
case pong = 0xA
|
||||
// B-F reserved.
|
||||
}
|
||||
|
||||
public enum CloseCode : UInt16 {
|
||||
case normal = 1000
|
||||
case goingAway = 1001
|
||||
case protocolError = 1002
|
||||
case protocolUnhandledType = 1003
|
||||
// 1004 reserved.
|
||||
case noStatusReceived = 1005
|
||||
//1006 reserved.
|
||||
case encoding = 1007
|
||||
case policyViolated = 1008
|
||||
case messageTooBig = 1009
|
||||
}
|
||||
|
||||
public static let ErrorDomain = "WebSocket"
|
||||
|
||||
enum InternalErrorCode: UInt16 {
|
||||
// 0-999 WebSocket status codes not used
|
||||
case outputStreamWriteError = 1
|
||||
}
|
||||
|
||||
// Where the callback is executed. It defaults to the main UI thread queue.
|
||||
public var callbackQueue = DispatchQueue.main
|
||||
|
||||
var optionalProtocols: [String]?
|
||||
|
||||
// MARK: - Constants
|
||||
let headerWSUpgradeName = "Upgrade"
|
||||
let headerWSUpgradeValue = "websocket"
|
||||
let headerWSHostName = "Host"
|
||||
let headerWSConnectionName = "Connection"
|
||||
let headerWSConnectionValue = "Upgrade"
|
||||
let headerWSProtocolName = "Sec-WebSocket-Protocol"
|
||||
let headerWSVersionName = "Sec-WebSocket-Version"
|
||||
let headerWSVersionValue = "13"
|
||||
let headerWSKeyName = "Sec-WebSocket-Key"
|
||||
let headerOriginName = "Origin"
|
||||
let headerWSAcceptName = "Sec-WebSocket-Accept"
|
||||
let BUFFER_MAX = 4096
|
||||
let FinMask: UInt8 = 0x80
|
||||
let OpCodeMask: UInt8 = 0x0F
|
||||
let RSVMask: UInt8 = 0x70
|
||||
let MaskMask: UInt8 = 0x80
|
||||
let PayloadLenMask: UInt8 = 0x7F
|
||||
let MaxFrameSize: Int = 32
|
||||
let httpSwitchProtocolCode = 101
|
||||
let supportedSSLSchemes = ["wss", "https"]
|
||||
|
||||
class WSResponse {
|
||||
var isFin = false
|
||||
var code: OpCode = .continueFrame
|
||||
var bytesLeft = 0
|
||||
var frameCount = 0
|
||||
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?
|
||||
|
||||
/// Receives a callback for each pong message recived.
|
||||
public weak var pongDelegate: WebSocketPongDelegate?
|
||||
|
||||
|
||||
// MARK: - Block based API.
|
||||
public var onConnect: (() -> Void)?
|
||||
public var onDisconnect: ((NSError?) -> Void)?
|
||||
public var onText: ((String) -> Void)?
|
||||
public var onData: ((Data) -> Void)?
|
||||
public var onPong: ((Data?) -> Void)?
|
||||
|
||||
public var headers = [String: String]()
|
||||
public var voipEnabled = false
|
||||
public var disableSSLCertValidation = false
|
||||
public var security: SSLTrustValidator?
|
||||
public var enabledSSLCipherSuites: [SSLCipherSuite]?
|
||||
public var origin: String?
|
||||
public var timeout = 5
|
||||
public var isConnected: Bool {
|
||||
return connected
|
||||
}
|
||||
|
||||
public var currentURL: URL { return url }
|
||||
|
||||
// MARK: - Private
|
||||
private var url: URL
|
||||
private var inputStream: InputStream?
|
||||
private var outputStream: OutputStream?
|
||||
private var connected = false
|
||||
private var isConnecting = false
|
||||
private var writeQueue = OperationQueue()
|
||||
private var readStack = [WSResponse]()
|
||||
private var inputQueue = [Data]()
|
||||
private var fragBuffer: Data?
|
||||
private var certValidated = false
|
||||
private var didDisconnect = false
|
||||
private var readyToWrite = false
|
||||
private let mutex = NSLock()
|
||||
private let notificationCenter = NotificationCenter.default
|
||||
private var canDispatch: Bool {
|
||||
mutex.lock()
|
||||
let canWork = readyToWrite
|
||||
mutex.unlock()
|
||||
return canWork
|
||||
}
|
||||
/// The shared processing queue used for all WebSocket.
|
||||
private static let sharedWorkQueue = DispatchQueue(label: "com.vluxe.starscream.websocket", attributes: [])
|
||||
|
||||
/// Used for setting protocols.
|
||||
public init(url: URL, protocols: [String]? = nil) {
|
||||
self.url = url
|
||||
self.origin = url.absoluteString
|
||||
if let hostUrl = URL (string: "/", relativeTo: url) {
|
||||
var origin = hostUrl.absoluteString
|
||||
origin.remove(at: origin.index(before: origin.endIndex))
|
||||
self.origin = origin
|
||||
}
|
||||
writeQueue.maxConcurrentOperationCount = 1
|
||||
optionalProtocols = protocols
|
||||
}
|
||||
|
||||
// Used for specifically setting the QOS for the write queue.
|
||||
public convenience init(url: URL, writeQueueQOS: QualityOfService, protocols: [String]? = nil) {
|
||||
self.init(url: url, protocols: protocols)
|
||||
writeQueue.qualityOfService = writeQueueQOS
|
||||
}
|
||||
|
||||
/**
|
||||
Connect to the WebSocket server on a background thread.
|
||||
*/
|
||||
open func connect() {
|
||||
guard !isConnecting else { return }
|
||||
didDisconnect = false
|
||||
isConnecting = true
|
||||
createHTTPRequest()
|
||||
}
|
||||
|
||||
/**
|
||||
Disconnect from the server. I send a Close control frame to the server, then expect the server to respond with a Close control frame and close the socket from its end. I notify my delegate once the socket has been closed.
|
||||
If you supply a non-nil `forceTimeout`, I wait at most that long (in seconds) for the server to close the socket. After the timeout expires, I close the socket and notify my delegate.
|
||||
If you supply a zero (or negative) `forceTimeout`, I immediately close the socket (without sending a Close control frame) and notify my delegate.
|
||||
- Parameter forceTimeout: Maximum time to wait for the server to close the socket.
|
||||
- Parameter closeCode: The code to send on disconnect. The default is the normal close code for cleanly disconnecting a webSocket.
|
||||
*/
|
||||
open func disconnect(forceTimeout: TimeInterval? = nil, closeCode: UInt16 = CloseCode.normal.rawValue) {
|
||||
guard isConnected else { return }
|
||||
switch forceTimeout {
|
||||
case .some(let seconds) where seconds > 0:
|
||||
let milliseconds = Int(seconds * 1_000)
|
||||
callbackQueue.asyncAfter(deadline: .now() + .milliseconds(milliseconds)) { [weak self] in
|
||||
self?.disconnectStream(nil)
|
||||
}
|
||||
fallthrough
|
||||
case .none:
|
||||
writeError(closeCode)
|
||||
default:
|
||||
disconnectStream(nil)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Write a string to the websocket. This sends it as a text frame.
|
||||
If you supply a non-nil completion block, I will perform it when the write completes.
|
||||
- parameter string: The string to write.
|
||||
- parameter completion: The (optional) completion handler.
|
||||
*/
|
||||
open func write(string: String, completion: (() -> ())? = nil) {
|
||||
guard isConnected else { return }
|
||||
dequeueWrite(string.data(using: String.Encoding.utf8)!, code: .textFrame, writeCompletion: completion)
|
||||
}
|
||||
|
||||
/**
|
||||
Write binary data to the websocket. This sends it as a binary frame.
|
||||
If you supply a non-nil completion block, I will perform it when the write completes.
|
||||
- parameter data: The data to write.
|
||||
- parameter completion: The (optional) completion handler.
|
||||
*/
|
||||
open func write(data: Data, completion: (() -> ())? = nil) {
|
||||
guard isConnected else { return }
|
||||
dequeueWrite(data, code: .binaryFrame, writeCompletion: completion)
|
||||
}
|
||||
|
||||
/**
|
||||
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
|
||||
*/
|
||||
open func write(ping: Data, completion: (() -> ())? = nil) {
|
||||
guard isConnected else { return }
|
||||
dequeueWrite(ping, code: .ping, writeCompletion: completion)
|
||||
}
|
||||
|
||||
/**
|
||||
Private method that starts the connection.
|
||||
*/
|
||||
private func createHTTPRequest() {
|
||||
let urlRequest = CFHTTPMessageCreateRequest(kCFAllocatorDefault, "GET" as CFString,
|
||||
url as CFURL, kCFHTTPVersion1_1).takeRetainedValue()
|
||||
|
||||
var port = url.port
|
||||
if port == nil {
|
||||
if supportedSSLSchemes.contains(url.scheme!) {
|
||||
port = 443
|
||||
} else {
|
||||
port = 80
|
||||
}
|
||||
}
|
||||
addHeader(urlRequest, key: headerWSUpgradeName, val: headerWSUpgradeValue)
|
||||
addHeader(urlRequest, key: headerWSConnectionName, val: headerWSConnectionValue)
|
||||
if let protocols = optionalProtocols {
|
||||
addHeader(urlRequest, key: headerWSProtocolName, val: protocols.joined(separator: ","))
|
||||
}
|
||||
addHeader(urlRequest, key: headerWSVersionName, val: headerWSVersionValue)
|
||||
addHeader(urlRequest, key: headerWSKeyName, val: generateWebSocketKey())
|
||||
if let origin = origin {
|
||||
addHeader(urlRequest, key: headerOriginName, val: origin)
|
||||
}
|
||||
addHeader(urlRequest, key: headerWSHostName, val: "\(url.host!):\(port!)")
|
||||
for (key, value) in headers {
|
||||
addHeader(urlRequest, key: key, val: value)
|
||||
}
|
||||
if let cfHTTPMessage = CFHTTPMessageCopySerializedMessage(urlRequest) {
|
||||
let serializedRequest = cfHTTPMessage.takeRetainedValue()
|
||||
initStreamsWithData(serializedRequest as Data, Int(port!))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Add a header to the CFHTTPMessage by using the NSString bridges to CFString
|
||||
*/
|
||||
private func addHeader(_ urlRequest: CFHTTPMessage, key: String, val: String) {
|
||||
CFHTTPMessageSetHeaderFieldValue(urlRequest, key as CFString, val as CFString)
|
||||
}
|
||||
|
||||
/**
|
||||
Generate a WebSocket key as needed in RFC.
|
||||
*/
|
||||
private func generateWebSocketKey() -> String {
|
||||
var key = ""
|
||||
let seed = 16
|
||||
for _ in 0..<seed {
|
||||
let uni = UnicodeScalar(UInt32(97 + arc4random_uniform(25)))
|
||||
key += "\(Character(uni!))"
|
||||
}
|
||||
let data = key.data(using: String.Encoding.utf8)
|
||||
let baseKey = data?.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
|
||||
return baseKey!
|
||||
}
|
||||
|
||||
/**
|
||||
Start the stream connection and write the data to the output stream.
|
||||
*/
|
||||
private func initStreamsWithData(_ data: Data, _ port: Int) {
|
||||
//higher level API we will cut over to at some point
|
||||
//NSStream.getStreamsToHostWithName(url.host, port: url.port.integerValue, inputStream: &inputStream, outputStream: &outputStream)
|
||||
// Disconnect and clean up any existing streams before setting up a new pair
|
||||
disconnectStream(nil, runDelegate: false)
|
||||
|
||||
var readStream: Unmanaged<CFReadStream>?
|
||||
var writeStream: Unmanaged<CFWriteStream>?
|
||||
let h = url.host! as NSString
|
||||
CFStreamCreatePairWithSocketToHost(nil, h, UInt32(port), &readStream, &writeStream)
|
||||
inputStream = readStream!.takeRetainedValue()
|
||||
outputStream = writeStream!.takeRetainedValue()
|
||||
guard let inStream = inputStream, let outStream = outputStream else { return }
|
||||
inStream.delegate = self
|
||||
outStream.delegate = self
|
||||
if supportedSSLSchemes.contains(url.scheme!) {
|
||||
certValidated = false
|
||||
inStream.setProperty(StreamSocketSecurityLevel.negotiatedSSL as AnyObject, forKey: Stream.PropertyKey.socketSecurityLevelKey)
|
||||
outStream.setProperty(StreamSocketSecurityLevel.negotiatedSSL as AnyObject, forKey: Stream.PropertyKey.socketSecurityLevelKey)
|
||||
if disableSSLCertValidation {
|
||||
let settings: [NSObject: NSObject] = [kCFStreamSSLValidatesCertificateChain: NSNumber(value: false), kCFStreamSSLPeerName: kCFNull]
|
||||
inStream.setProperty(settings, forKey: kCFStreamPropertySSLSettings as Stream.PropertyKey)
|
||||
outStream.setProperty(settings, forKey: kCFStreamPropertySSLSettings as Stream.PropertyKey)
|
||||
}
|
||||
if let cipherSuites = self.enabledSSLCipherSuites {
|
||||
if let sslContextIn = CFReadStreamCopyProperty(inputStream, CFStreamPropertyKey(rawValue: kCFStreamPropertySSLContext)) as! SSLContext?,
|
||||
let sslContextOut = CFWriteStreamCopyProperty(outputStream, CFStreamPropertyKey(rawValue: kCFStreamPropertySSLContext)) as! SSLContext? {
|
||||
let resIn = SSLSetEnabledCiphers(sslContextIn, cipherSuites, cipherSuites.count)
|
||||
let resOut = SSLSetEnabledCiphers(sslContextOut, cipherSuites, cipherSuites.count)
|
||||
if resIn != errSecSuccess {
|
||||
let error = self.errorWithDetail("Error setting ingoing cypher suites", code: UInt16(resIn))
|
||||
disconnectStream(error)
|
||||
return
|
||||
}
|
||||
if resOut != errSecSuccess {
|
||||
let error = self.errorWithDetail("Error setting outgoing cypher suites", code: UInt16(resOut))
|
||||
disconnectStream(error)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
certValidated = true //not a https session, so no need to check SSL pinning
|
||||
}
|
||||
if voipEnabled {
|
||||
inStream.setProperty(StreamNetworkServiceTypeValue.voIP as AnyObject, forKey: Stream.PropertyKey.networkServiceType)
|
||||
outStream.setProperty(StreamNetworkServiceTypeValue.voIP as AnyObject, forKey: Stream.PropertyKey.networkServiceType)
|
||||
}
|
||||
|
||||
CFReadStreamSetDispatchQueue(inStream, WebSocket.sharedWorkQueue)
|
||||
CFWriteStreamSetDispatchQueue(outStream, WebSocket.sharedWorkQueue)
|
||||
inStream.open()
|
||||
outStream.open()
|
||||
|
||||
self.mutex.lock()
|
||||
self.readyToWrite = true
|
||||
self.mutex.unlock()
|
||||
|
||||
let bytes = UnsafeRawPointer((data as NSData).bytes).assumingMemoryBound(to: UInt8.self)
|
||||
var out = timeout * 1_000_000 // wait 5 seconds before giving up
|
||||
let operation = BlockOperation()
|
||||
operation.addExecutionBlock { [weak self, weak operation] in
|
||||
guard let sOperation = operation else { return }
|
||||
while !outStream.hasSpaceAvailable && !sOperation.isCancelled {
|
||||
usleep(100) // wait until the socket is ready
|
||||
guard !sOperation.isCancelled else { return }
|
||||
out -= 100
|
||||
if out < 0 {
|
||||
WebSocket.sharedWorkQueue.async {
|
||||
self?.cleanupStream()
|
||||
}
|
||||
self?.doDisconnect(self?.errorWithDetail("write wait timed out", code: 2))
|
||||
return
|
||||
} else if outStream.streamError != nil {
|
||||
return // disconnectStream will be called.
|
||||
}
|
||||
}
|
||||
guard !sOperation.isCancelled, let s = self else { return }
|
||||
// Do the pinning now if needed
|
||||
if let sec = s.security, !s.certValidated {
|
||||
let trust = outStream.property(forKey: kCFStreamPropertySSLPeerTrust as Stream.PropertyKey) as! SecTrust
|
||||
let domain = outStream.property(forKey: kCFStreamSSLPeerName as Stream.PropertyKey) as? String
|
||||
s.certValidated = sec.isValid(trust, domain: domain)
|
||||
if !s.certValidated {
|
||||
WebSocket.sharedWorkQueue.async {
|
||||
let error = s.errorWithDetail("Invalid SSL certificate", code: 1)
|
||||
s.disconnectStream(error)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
outStream.write(bytes, maxLength: data.count)
|
||||
}
|
||||
writeQueue.addOperation(operation)
|
||||
}
|
||||
|
||||
/**
|
||||
Delegate for the stream methods. Processes incoming bytes
|
||||
*/
|
||||
open func stream(_ aStream: Stream, handle eventCode: Stream.Event) {
|
||||
if eventCode == .hasBytesAvailable {
|
||||
if aStream == inputStream {
|
||||
processInputStream()
|
||||
}
|
||||
} else if eventCode == .errorOccurred {
|
||||
disconnectStream(aStream.streamError as NSError?)
|
||||
} else if eventCode == .endEncountered {
|
||||
disconnectStream(nil)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Disconnect the stream object and notifies the delegate.
|
||||
*/
|
||||
private func disconnectStream(_ error: NSError?, runDelegate: Bool = true) {
|
||||
if error == nil {
|
||||
writeQueue.waitUntilAllOperationsAreFinished()
|
||||
} else {
|
||||
writeQueue.cancelAllOperations()
|
||||
}
|
||||
cleanupStream()
|
||||
connected = false
|
||||
if runDelegate {
|
||||
doDisconnect(error)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
cleanup the streams.
|
||||
*/
|
||||
private func cleanupStream() {
|
||||
outputStream?.delegate = nil
|
||||
inputStream?.delegate = nil
|
||||
if let stream = inputStream {
|
||||
CFReadStreamSetDispatchQueue(stream, nil)
|
||||
stream.close()
|
||||
}
|
||||
if let stream = outputStream {
|
||||
CFWriteStreamSetDispatchQueue(stream, nil)
|
||||
stream.close()
|
||||
}
|
||||
outputStream = nil
|
||||
inputStream = nil
|
||||
fragBuffer = nil
|
||||
}
|
||||
|
||||
/**
|
||||
Handles the incoming bytes and sending them to the proper processing method.
|
||||
*/
|
||||
private func processInputStream() {
|
||||
let buf = NSMutableData(capacity: BUFFER_MAX)
|
||||
let buffer = UnsafeMutableRawPointer(mutating: buf!.bytes).assumingMemoryBound(to: UInt8.self)
|
||||
let length = inputStream!.read(buffer, maxLength: BUFFER_MAX)
|
||||
guard length > 0 else { return }
|
||||
var process = false
|
||||
if inputQueue.count == 0 {
|
||||
process = true
|
||||
}
|
||||
inputQueue.append(Data(bytes: buffer, count: length))
|
||||
if process {
|
||||
dequeueInput()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Dequeue the incoming input so it is processed in order.
|
||||
*/
|
||||
private func dequeueInput() {
|
||||
while !inputQueue.isEmpty {
|
||||
autoreleasepool {
|
||||
let data = inputQueue[0]
|
||||
var work = data
|
||||
if let buffer = fragBuffer {
|
||||
var combine = NSData(data: buffer) as Data
|
||||
combine.append(data)
|
||||
work = combine
|
||||
fragBuffer = nil
|
||||
}
|
||||
let buffer = UnsafeRawPointer((work as NSData).bytes).assumingMemoryBound(to: UInt8.self)
|
||||
let length = work.count
|
||||
if !connected {
|
||||
processTCPHandshake(buffer, bufferLen: length)
|
||||
} else {
|
||||
processRawMessagesInBuffer(buffer, bufferLen: length)
|
||||
}
|
||||
inputQueue = inputQueue.filter{ $0 != data }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Handle checking the inital connection status
|
||||
*/
|
||||
private func processTCPHandshake(_ buffer: UnsafePointer<UInt8>, bufferLen: Int) {
|
||||
let code = processHTTP(buffer, bufferLen: bufferLen)
|
||||
switch code {
|
||||
case 0:
|
||||
break
|
||||
case -1:
|
||||
fragBuffer = Data(bytes: buffer, count: bufferLen)
|
||||
break // do nothing, we are going to collect more data
|
||||
default:
|
||||
doDisconnect(errorWithDetail("Invalid HTTP upgrade", code: UInt16(code)))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Finds the HTTP Packet in the TCP stream, by looking for the CRLF.
|
||||
*/
|
||||
private func processHTTP(_ buffer: UnsafePointer<UInt8>, bufferLen: Int) -> Int {
|
||||
let CRLFBytes = [UInt8(ascii: "\r"), UInt8(ascii: "\n"), UInt8(ascii: "\r"), UInt8(ascii: "\n")]
|
||||
var k = 0
|
||||
var totalSize = 0
|
||||
for i in 0..<bufferLen {
|
||||
if buffer[i] == CRLFBytes[k] {
|
||||
k += 1
|
||||
if k == 3 {
|
||||
totalSize = i + 1
|
||||
break
|
||||
}
|
||||
} else {
|
||||
k = 0
|
||||
}
|
||||
}
|
||||
if totalSize > 0 {
|
||||
let code = validateResponse(buffer, bufferLen: totalSize)
|
||||
if code != 0 {
|
||||
return code
|
||||
}
|
||||
isConnecting = false
|
||||
connected = true
|
||||
didDisconnect = false
|
||||
if canDispatch {
|
||||
callbackQueue.async { [weak self] in
|
||||
guard let s = self else { return }
|
||||
s.onConnect?()
|
||||
s.delegate?.websocketDidConnect(socket: s)
|
||||
s.notificationCenter.post(name: NSNotification.Name(WebsocketDidConnectNotification), object: self)
|
||||
}
|
||||
}
|
||||
totalSize += 1 //skip the last \n
|
||||
let restSize = bufferLen - totalSize
|
||||
if restSize > 0 {
|
||||
processRawMessagesInBuffer(buffer + totalSize, bufferLen: restSize)
|
||||
}
|
||||
return 0 //success
|
||||
}
|
||||
return -1 // Was unable to find the full TCP header.
|
||||
}
|
||||
|
||||
/**
|
||||
Validates the HTTP is a 101 as per the RFC spec.
|
||||
*/
|
||||
private func validateResponse(_ buffer: UnsafePointer<UInt8>, bufferLen: Int) -> Int {
|
||||
let response = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, false).takeRetainedValue()
|
||||
CFHTTPMessageAppendBytes(response, buffer, bufferLen)
|
||||
let code = CFHTTPMessageGetResponseStatusCode(response)
|
||||
if code != httpSwitchProtocolCode {
|
||||
return code
|
||||
}
|
||||
if let cfHeaders = CFHTTPMessageCopyAllHeaderFields(response) {
|
||||
let headers = cfHeaders.takeRetainedValue() as NSDictionary
|
||||
if let acceptKey = headers[headerWSAcceptName as NSString] as? NSString {
|
||||
if acceptKey.length > 0 {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
/**
|
||||
Read a 16 bit big endian value from a buffer
|
||||
*/
|
||||
private static func readUint16(_ buffer: UnsafePointer<UInt8>, offset: Int) -> UInt16 {
|
||||
return (UInt16(buffer[offset + 0]) << 8) | UInt16(buffer[offset + 1])
|
||||
}
|
||||
|
||||
/**
|
||||
Read a 64 bit big endian value from a buffer
|
||||
*/
|
||||
private static func readUint64(_ buffer: UnsafePointer<UInt8>, offset: Int) -> UInt64 {
|
||||
var value = UInt64(0)
|
||||
for i in 0...7 {
|
||||
value = (value << 8) | UInt64(buffer[offset + i])
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
Write a 16-bit big endian value to a buffer.
|
||||
*/
|
||||
private static func writeUint16(_ buffer: UnsafeMutablePointer<UInt8>, offset: Int, value: UInt16) {
|
||||
buffer[offset + 0] = UInt8(value >> 8)
|
||||
buffer[offset + 1] = UInt8(value & 0xff)
|
||||
}
|
||||
|
||||
/**
|
||||
Write a 64-bit big endian value to a buffer.
|
||||
*/
|
||||
private static func writeUint64(_ buffer: UnsafeMutablePointer<UInt8>, offset: Int, value: UInt64) {
|
||||
for i in 0...7 {
|
||||
buffer[offset + i] = UInt8((value >> (8*UInt64(7 - i))) & 0xff)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Process one message at the start of `buffer`. Return another buffer (sharing storage) that contains the leftover contents of `buffer` that I didn't process.
|
||||
*/
|
||||
private func processOneRawMessage(inBuffer buffer: UnsafeBufferPointer<UInt8>) -> UnsafeBufferPointer<UInt8> {
|
||||
let response = readStack.last
|
||||
guard let baseAddress = buffer.baseAddress else {return emptyBuffer}
|
||||
let bufferLen = buffer.count
|
||||
if response != nil && bufferLen < 2 {
|
||||
fragBuffer = Data(buffer: buffer)
|
||||
return emptyBuffer
|
||||
}
|
||||
if let response = response, response.bytesLeft > 0 {
|
||||
var len = response.bytesLeft
|
||||
var extra = bufferLen - response.bytesLeft
|
||||
if response.bytesLeft > bufferLen {
|
||||
len = bufferLen
|
||||
extra = 0
|
||||
}
|
||||
response.bytesLeft -= len
|
||||
response.buffer?.append(Data(bytes: baseAddress, count: len))
|
||||
_ = processResponse(response)
|
||||
return buffer.fromOffset(bufferLen - extra)
|
||||
} else {
|
||||
let isFin = (FinMask & baseAddress[0])
|
||||
let receivedOpcodeRawValue = (OpCodeMask & baseAddress[0])
|
||||
let receivedOpcode = OpCode(rawValue: receivedOpcodeRawValue)
|
||||
let isMasked = (MaskMask & baseAddress[1])
|
||||
let payloadLen = (PayloadLenMask & baseAddress[1])
|
||||
var offset = 2
|
||||
if (isMasked > 0 || (RSVMask & baseAddress[0]) > 0) && receivedOpcode != .pong {
|
||||
let errCode = CloseCode.protocolError.rawValue
|
||||
doDisconnect(errorWithDetail("masked and rsv data is not currently supported", code: errCode))
|
||||
writeError(errCode)
|
||||
return emptyBuffer
|
||||
}
|
||||
let isControlFrame = (receivedOpcode == .connectionClose || receivedOpcode == .ping)
|
||||
if !isControlFrame && (receivedOpcode != .binaryFrame && receivedOpcode != .continueFrame &&
|
||||
receivedOpcode != .textFrame && receivedOpcode != .pong) {
|
||||
let errCode = CloseCode.protocolError.rawValue
|
||||
doDisconnect(errorWithDetail("unknown opcode: \(receivedOpcodeRawValue)", code: errCode))
|
||||
writeError(errCode)
|
||||
return emptyBuffer
|
||||
}
|
||||
if isControlFrame && isFin == 0 {
|
||||
let errCode = CloseCode.protocolError.rawValue
|
||||
doDisconnect(errorWithDetail("control frames can't be fragmented", code: errCode))
|
||||
writeError(errCode)
|
||||
return emptyBuffer
|
||||
}
|
||||
var closeCode = CloseCode.normal.rawValue
|
||||
if receivedOpcode == .connectionClose {
|
||||
if payloadLen == 1 {
|
||||
closeCode = CloseCode.protocolError.rawValue
|
||||
} else if payloadLen > 1 {
|
||||
closeCode = WebSocket.readUint16(baseAddress, offset: offset)
|
||||
if closeCode < 1000 || (closeCode > 1003 && closeCode < 1007) || (closeCode > 1011 && closeCode < 3000) {
|
||||
closeCode = CloseCode.protocolError.rawValue
|
||||
}
|
||||
}
|
||||
if payloadLen < 2 {
|
||||
doDisconnect(errorWithDetail("connection closed by server", code: closeCode))
|
||||
writeError(closeCode)
|
||||
return emptyBuffer
|
||||
}
|
||||
} else if isControlFrame && payloadLen > 125 {
|
||||
writeError(CloseCode.protocolError.rawValue)
|
||||
return emptyBuffer
|
||||
}
|
||||
var dataLength = UInt64(payloadLen)
|
||||
if dataLength == 127 {
|
||||
dataLength = WebSocket.readUint64(baseAddress, offset: offset)
|
||||
offset += MemoryLayout<UInt64>.size
|
||||
} else if dataLength == 126 {
|
||||
dataLength = UInt64(WebSocket.readUint16(baseAddress, offset: offset))
|
||||
offset += MemoryLayout<UInt16>.size
|
||||
}
|
||||
if bufferLen < offset || UInt64(bufferLen - offset) < dataLength {
|
||||
fragBuffer = Data(bytes: baseAddress, count: bufferLen)
|
||||
return emptyBuffer
|
||||
}
|
||||
var len = dataLength
|
||||
if dataLength > UInt64(bufferLen) {
|
||||
len = UInt64(bufferLen-offset)
|
||||
}
|
||||
if receivedOpcode == .connectionClose && len > 0 {
|
||||
let size = MemoryLayout<UInt16>.size
|
||||
offset += size
|
||||
len -= UInt64(size)
|
||||
}
|
||||
let data = Data(bytes: baseAddress+offset, count: Int(len))
|
||||
|
||||
if receivedOpcode == .connectionClose {
|
||||
var closeReason = "connection closed by server"
|
||||
if let customCloseReason = String(data: data, encoding: .utf8) {
|
||||
closeReason = customCloseReason
|
||||
} else {
|
||||
closeCode = CloseCode.protocolError.rawValue
|
||||
}
|
||||
doDisconnect(errorWithDetail(closeReason, code: closeCode))
|
||||
writeError(closeCode)
|
||||
return emptyBuffer
|
||||
}
|
||||
if receivedOpcode == .pong {
|
||||
if canDispatch {
|
||||
callbackQueue.async { [weak self] in
|
||||
guard let s = self else { return }
|
||||
let pongData: Data? = data.count > 0 ? data : nil
|
||||
s.onPong?(pongData)
|
||||
s.pongDelegate?.websocketDidReceivePong(socket: s, data: pongData)
|
||||
}
|
||||
}
|
||||
return buffer.fromOffset(offset + Int(len))
|
||||
}
|
||||
var response = readStack.last
|
||||
if isControlFrame {
|
||||
response = nil // Don't append pings.
|
||||
}
|
||||
if isFin == 0 && receivedOpcode == .continueFrame && response == nil {
|
||||
let errCode = CloseCode.protocolError.rawValue
|
||||
doDisconnect(errorWithDetail("continue frame before a binary or text frame", code: errCode))
|
||||
writeError(errCode)
|
||||
return emptyBuffer
|
||||
}
|
||||
var isNew = false
|
||||
if response == nil {
|
||||
if receivedOpcode == .continueFrame {
|
||||
let errCode = CloseCode.protocolError.rawValue
|
||||
doDisconnect(errorWithDetail("first frame can't be a continue frame",
|
||||
code: errCode))
|
||||
writeError(errCode)
|
||||
return emptyBuffer
|
||||
}
|
||||
isNew = true
|
||||
response = WSResponse()
|
||||
response!.code = receivedOpcode!
|
||||
response!.bytesLeft = Int(dataLength)
|
||||
response!.buffer = NSMutableData(data: data)
|
||||
} else {
|
||||
if receivedOpcode == .continueFrame {
|
||||
response!.bytesLeft = Int(dataLength)
|
||||
} else {
|
||||
let errCode = CloseCode.protocolError.rawValue
|
||||
doDisconnect(errorWithDetail("second and beyond of fragment message must be a continue frame",
|
||||
code: errCode))
|
||||
writeError(errCode)
|
||||
return emptyBuffer
|
||||
}
|
||||
response!.buffer!.append(data)
|
||||
}
|
||||
if let response = response {
|
||||
response.bytesLeft -= Int(len)
|
||||
response.frameCount += 1
|
||||
response.isFin = isFin > 0 ? true : false
|
||||
if isNew {
|
||||
readStack.append(response)
|
||||
}
|
||||
_ = processResponse(response)
|
||||
}
|
||||
|
||||
let step = Int(offset + numericCast(len))
|
||||
return buffer.fromOffset(step)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Process all messages in the buffer if possible.
|
||||
*/
|
||||
private func processRawMessagesInBuffer(_ pointer: UnsafePointer<UInt8>, bufferLen: Int) {
|
||||
var buffer = UnsafeBufferPointer(start: pointer, count: bufferLen)
|
||||
repeat {
|
||||
buffer = processOneRawMessage(inBuffer: buffer)
|
||||
} while buffer.count >= 2
|
||||
if buffer.count > 0 {
|
||||
fragBuffer = Data(buffer: buffer)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Process the finished response of a buffer.
|
||||
*/
|
||||
private func processResponse(_ response: WSResponse) -> Bool {
|
||||
if response.isFin && response.bytesLeft <= 0 {
|
||||
if response.code == .ping {
|
||||
let data = response.buffer! // local copy so it is perverse for writing
|
||||
dequeueWrite(data as Data, code: .pong)
|
||||
} else if response.code == .textFrame {
|
||||
let str: NSString? = NSString(data: response.buffer! as Data, encoding: String.Encoding.utf8.rawValue)
|
||||
if str == nil {
|
||||
writeError(CloseCode.encoding.rawValue)
|
||||
return false
|
||||
}
|
||||
if canDispatch {
|
||||
callbackQueue.async { [weak self] in
|
||||
guard let s = self else { return }
|
||||
s.onText?(str! as String)
|
||||
s.delegate?.websocketDidReceiveMessage(socket: s, text: str! as String)
|
||||
}
|
||||
}
|
||||
} else if response.code == .binaryFrame {
|
||||
if canDispatch {
|
||||
let data = response.buffer! // local copy so it is perverse for writing
|
||||
callbackQueue.async { [weak self] in
|
||||
guard let s = self else { return }
|
||||
s.onData?(data as Data)
|
||||
s.delegate?.websocketDidReceiveData(socket: s, data: data as Data)
|
||||
}
|
||||
}
|
||||
}
|
||||
readStack.removeLast()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
Create an error
|
||||
*/
|
||||
private func errorWithDetail(_ detail: String, code: UInt16) -> NSError {
|
||||
var details = [String: String]()
|
||||
details[NSLocalizedDescriptionKey] = detail
|
||||
return NSError(domain: WebSocket.ErrorDomain, code: Int(code), userInfo: details)
|
||||
}
|
||||
|
||||
/**
|
||||
Write an error to the socket
|
||||
*/
|
||||
private func writeError(_ code: UInt16) {
|
||||
let buf = NSMutableData(capacity: MemoryLayout<UInt16>.size)
|
||||
let buffer = UnsafeMutableRawPointer(mutating: buf!.bytes).assumingMemoryBound(to: UInt8.self)
|
||||
WebSocket.writeUint16(buffer, offset: 0, value: code)
|
||||
dequeueWrite(Data(bytes: buffer, count: MemoryLayout<UInt16>.size), code: .connectionClose)
|
||||
}
|
||||
|
||||
/**
|
||||
Used to write things to the stream
|
||||
*/
|
||||
private func dequeueWrite(_ data: Data, code: OpCode, writeCompletion: (() -> ())? = nil) {
|
||||
let operation = BlockOperation()
|
||||
operation.addExecutionBlock { [weak self, weak operation] in
|
||||
//stream isn't ready, let's wait
|
||||
guard let s = self else { return }
|
||||
guard let sOperation = operation else { return }
|
||||
var offset = 2
|
||||
let dataLength = data.count
|
||||
let frame = NSMutableData(capacity: dataLength + s.MaxFrameSize)
|
||||
let buffer = UnsafeMutableRawPointer(frame!.mutableBytes).assumingMemoryBound(to: UInt8.self)
|
||||
buffer[0] = s.FinMask | code.rawValue
|
||||
if dataLength < 126 {
|
||||
buffer[1] = CUnsignedChar(dataLength)
|
||||
} else if dataLength <= Int(UInt16.max) {
|
||||
buffer[1] = 126
|
||||
WebSocket.writeUint16(buffer, offset: offset, value: UInt16(dataLength))
|
||||
offset += MemoryLayout<UInt16>.size
|
||||
} else {
|
||||
buffer[1] = 127
|
||||
WebSocket.writeUint64(buffer, offset: offset, value: UInt64(dataLength))
|
||||
offset += MemoryLayout<UInt64>.size
|
||||
}
|
||||
buffer[1] |= s.MaskMask
|
||||
let maskKey = UnsafeMutablePointer<UInt8>(buffer + offset)
|
||||
_ = SecRandomCopyBytes(kSecRandomDefault, Int(MemoryLayout<UInt32>.size), maskKey)
|
||||
offset += MemoryLayout<UInt32>.size
|
||||
|
||||
for i in 0..<dataLength {
|
||||
buffer[offset] = data[i] ^ maskKey[i % MemoryLayout<UInt32>.size]
|
||||
offset += 1
|
||||
}
|
||||
var total = 0
|
||||
while !sOperation.isCancelled {
|
||||
guard let outStream = s.outputStream else { break }
|
||||
let writeBuffer = UnsafeRawPointer(frame!.bytes+total).assumingMemoryBound(to: UInt8.self)
|
||||
let len = outStream.write(writeBuffer, maxLength: offset-total)
|
||||
if len < 0 {
|
||||
var error: Error?
|
||||
if let streamError = outStream.streamError {
|
||||
error = streamError
|
||||
} else {
|
||||
let errCode = InternalErrorCode.outputStreamWriteError.rawValue
|
||||
error = s.errorWithDetail("output stream error during write", code: errCode)
|
||||
}
|
||||
s.doDisconnect(error as NSError?)
|
||||
break
|
||||
} else {
|
||||
total += len
|
||||
}
|
||||
if total >= offset {
|
||||
if let queue = self?.callbackQueue, let callback = writeCompletion {
|
||||
queue.async {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
writeQueue.addOperation(operation)
|
||||
}
|
||||
|
||||
/**
|
||||
Used to preform the disconnect delegate
|
||||
*/
|
||||
private func doDisconnect(_ error: NSError?) {
|
||||
guard !didDisconnect else { return }
|
||||
didDisconnect = true
|
||||
isConnecting = false
|
||||
connected = false
|
||||
guard canDispatch else {return}
|
||||
callbackQueue.async { [weak self] in
|
||||
guard let s = self else { return }
|
||||
s.onDisconnect?(error)
|
||||
s.delegate?.websocketDidDisconnect(socket: s, error: error)
|
||||
let userInfo = error.map{ [WebsocketDisconnectionErrorKeyName: $0] }
|
||||
s.notificationCenter.post(name: NSNotification.Name(WebsocketDidDisconnectNotification), object: self, userInfo: userInfo)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Deinit
|
||||
deinit {
|
||||
mutex.lock()
|
||||
readyToWrite = false
|
||||
mutex.unlock()
|
||||
cleanupStream()
|
||||
writeQueue.cancelAllOperations()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private extension Data {
|
||||
|
||||
init(buffer: UnsafeBufferPointer<UInt8>) {
|
||||
self.init(bytes: buffer.baseAddress!, count: buffer.count)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private extension UnsafeBufferPointer {
|
||||
|
||||
func fromOffset(_ offset: Int) -> UnsafeBufferPointer<Element> {
|
||||
return UnsafeBufferPointer<Element>(start: baseAddress?.advanced(by: offset), count: count - offset)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private let emptyBuffer = UnsafeBufferPointer<UInt8>(start: nil, count: 0)
|
||||
+3
-4
@@ -21,14 +21,13 @@ class SocketAckManagerTest : XCTestCase {
|
||||
}
|
||||
|
||||
ackManager.addAck(1, callback: callback)
|
||||
ackManager.executeAck(1, with: itemsArray, onQueue: DispatchQueue.main)
|
||||
ackManager.executeAck(1, with: itemsArray)
|
||||
|
||||
waitForExpectations(timeout: 3.0, handler: nil)
|
||||
}
|
||||
|
||||
func testManagerTimeoutAck() {
|
||||
let callbackExpection = expectation(description: "Manager should timeout ack with noAck status")
|
||||
let itemsArray = ["Hi", "ho"]
|
||||
|
||||
func callback(_ items: [Any]) {
|
||||
XCTAssertEqual(items.count, 1, "Timed out ack should have one value")
|
||||
@@ -38,13 +37,13 @@ class SocketAckManagerTest : XCTestCase {
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(timeoutReason, SocketAckStatus.noAck.rawValue)
|
||||
XCTAssert(timeoutReason == SocketAckStatus.noAck)
|
||||
|
||||
callbackExpection.fulfill()
|
||||
}
|
||||
|
||||
ackManager.addAck(1, callback: callback)
|
||||
ackManager.timeoutAck(1, onQueue: DispatchQueue.main)
|
||||
ackManager.timeoutAck(1)
|
||||
|
||||
waitForExpectations(timeout: 0.2, handler: nil)
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
//
|
||||
// SocketBasicPacketTest.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/7/15.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SocketIO
|
||||
|
||||
class SocketBasicPacketTest : XCTestCase {
|
||||
func testEmptyEmit() {
|
||||
let sendData = ["test"]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testNullEmit() {
|
||||
let sendData: [Any] = ["test", NSNull()]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testStringEmit() {
|
||||
let sendData = ["test", "foo bar"]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testStringEmitWithQuotes() {
|
||||
let sendData = ["test", "\"he\"llo world\""]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testJSONEmit() {
|
||||
let sendData: [Any] = ["test", ["foobar": true, "hello": 1, "test": "hello", "null": NSNull()]]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testArrayEmit() {
|
||||
let sendData: [Any] = ["test", ["hello", 1, ["test": "test"]]]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testBinaryEmit() {
|
||||
let sendData: [Any] = ["test", data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .binaryEvent)
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: [
|
||||
"test",
|
||||
["_placeholder": true, "num": 0]
|
||||
]))
|
||||
}
|
||||
|
||||
func testMultipleBinaryEmit() {
|
||||
let sendData: [Any] = ["test", ["data1": data, "data2": data2] as NSDictionary]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .binaryEvent)
|
||||
|
||||
let binaryObj = parsed.data[1] as! [String: Any]
|
||||
let data1Loc = (binaryObj["data1"] as! [String: Any])["num"] as! Int
|
||||
let data2Loc = (binaryObj["data2"] as! [String: Any])["num"] as! Int
|
||||
|
||||
XCTAssertEqual(packet.binary[data1Loc], data)
|
||||
XCTAssertEqual(packet.binary[data2Loc], data2)
|
||||
}
|
||||
|
||||
func testEmitWithAck() {
|
||||
let sendData = ["test"]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: false).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testEmitDataWithAck() {
|
||||
let sendData: [Any] = ["test", data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .binaryEvent)
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: [
|
||||
"test",
|
||||
["_placeholder": true, "num": 0]
|
||||
]))
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
}
|
||||
|
||||
// Acks
|
||||
func testEmptyAck() {
|
||||
let packetStr = SocketPacket.packetFromEmit([], id: 0, nsp: "/", ack: true).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .ack)
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: []))
|
||||
}
|
||||
|
||||
func testNullAck() {
|
||||
let sendData = [NSNull()]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .ack)
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testStringAck() {
|
||||
let sendData = ["test"]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .ack)
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testJSONAck() {
|
||||
let sendData = [["foobar": true, "hello": 1, "test": "hello", "null": NSNull()]]
|
||||
let packetStr = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true).packetString
|
||||
let parsed = parser.parseSocketMessage(packetStr)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .ack)
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testBinaryAck() {
|
||||
let sendData = [data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .binaryAck)
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: [
|
||||
["_placeholder": true, "num": 0]
|
||||
]))
|
||||
}
|
||||
|
||||
func testMultipleBinaryAck() {
|
||||
let sendData = [["data1": data, "data2": data2]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/", ack: true)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertEqual(parsed.type, .binaryAck)
|
||||
|
||||
let binaryObj = parsed.data[0] as! [String: Any]
|
||||
let data1Loc = (binaryObj["data1"] as! [String: Any])["num"] as! Int
|
||||
let data2Loc = (binaryObj["data2"] as! [String: Any])["num"] as! Int
|
||||
|
||||
XCTAssertEqual(packet.binary[data1Loc], data)
|
||||
XCTAssertEqual(packet.binary[data2Loc], data2)
|
||||
}
|
||||
|
||||
func testBinaryStringPlaceholderInMessage() {
|
||||
let engineString = "52-[\"test\",\"~~0\",{\"num\":0,\"_placeholder\":true},{\"_placeholder\":true,\"num\":1}]"
|
||||
let manager = SocketManager(socketURL: URL(string: "http://localhost/")!)
|
||||
|
||||
var packet = try! manager.parseString(engineString)
|
||||
|
||||
XCTAssertEqual(packet.event, "test")
|
||||
_ = packet.addData(data)
|
||||
_ = packet.addData(data2)
|
||||
XCTAssertEqual(packet.args[0] as? String, "~~0")
|
||||
}
|
||||
|
||||
private func compareAnyArray(input: [Any], expected: [Any]) -> Bool {
|
||||
guard input.count == expected.count else { return false }
|
||||
|
||||
return (input as NSArray).isEqual(to: expected)
|
||||
}
|
||||
|
||||
let data = "test".data(using: String.Encoding.utf8)!
|
||||
let data2 = "test2".data(using: String.Encoding.utf8)!
|
||||
var parser: SocketParsable!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
parser = SocketManager(socketURL: URL(string: "http://localhost")!)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
//
|
||||
// SocketEngineTest.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/15/15.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SocketIO
|
||||
|
||||
class SocketEngineTest: XCTestCase {
|
||||
func testBasicPollingMessageV3() {
|
||||
let expect = expectation(description: "Basic polling test v3")
|
||||
|
||||
socket.on("blankTest") {data, ack in
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
engine.setConfigs([.version(.two)])
|
||||
engine.parsePollingMessage("15:42[\"blankTest\"]")
|
||||
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testBasicPollingMessage() {
|
||||
let expect = expectation(description: "Basic polling test")
|
||||
socket.on("blankTest") {data, ack in
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
engine.parsePollingMessage("42[\"blankTest\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testTwoPacketsInOnePollTest() {
|
||||
let finalExpectation = expectation(description: "Final packet in poll test")
|
||||
var gotBlank = false
|
||||
|
||||
socket.on("blankTest") {data, ack in
|
||||
gotBlank = true
|
||||
}
|
||||
|
||||
socket.on("stringTest") {data, ack in
|
||||
if let str = data[0] as? String, gotBlank {
|
||||
if str == "hello" {
|
||||
finalExpectation.fulfill()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
engine.parsePollingMessage("42[\"blankTest\"]\u{1e}42[\"stringTest\",\"hello\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testEngineDoesErrorOnUnknownTransport() {
|
||||
let finalExpectation = expectation(description: "Unknown Transport")
|
||||
|
||||
socket.on("error") {data, ack in
|
||||
if let error = data[0] as? String, error == "Unknown transport" {
|
||||
finalExpectation.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
engine.parseEngineMessage("{\"code\": 0, \"message\": \"Unknown transport\"}")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testEngineDoesErrorOnUnknownMessage() {
|
||||
let finalExpectation = expectation(description: "Engine Errors")
|
||||
|
||||
socket.on("error") {data, ack in
|
||||
finalExpectation.fulfill()
|
||||
}
|
||||
|
||||
engine.parseEngineMessage("afafafda")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testEngineDecodesUTF8Properly() {
|
||||
let expect = expectation(description: "Engine Decodes utf8")
|
||||
|
||||
socket.on("stringTest") {data, ack in
|
||||
XCTAssertEqual(data[0] as? String, "lïne one\nlīne \rtwo𦅙𦅛", "Failed string test")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
let stringMessage = "42[\"stringTest\",\"lïne one\\nlīne \\rtwo𦅙𦅛\"]"
|
||||
|
||||
engine.parsePollingMessage("\(stringMessage)")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testEncodeURLProperly() {
|
||||
engine.connectParams = [
|
||||
"created": "2016-05-04T18:31:15+0200"
|
||||
]
|
||||
|
||||
XCTAssertEqual(engine.urlPolling.query, "transport=polling&b64=1&created=2016-05-04T18%3A31%3A15%2B0200&EIO=4")
|
||||
XCTAssertEqual(engine.urlWebSocket.query, "transport=websocket&created=2016-05-04T18%3A31%3A15%2B0200&EIO=4")
|
||||
|
||||
engine.connectParams = [
|
||||
"forbidden": "!*'();:@&=+$,/?%#[]\" {}^|"
|
||||
]
|
||||
|
||||
XCTAssertEqual(engine.urlPolling.query, "transport=polling&b64=1&forbidden=%21%2A%27%28%29%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23%5B%5D%22%20%7B%7D%5E%7C&EIO=4")
|
||||
XCTAssertEqual(engine.urlWebSocket.query, "transport=websocket&forbidden=%21%2A%27%28%29%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23%5B%5D%22%20%7B%7D%5E%7C&EIO=4")
|
||||
}
|
||||
|
||||
func testBase64Data() {
|
||||
let expect = expectation(description: "Engine Decodes base64 data")
|
||||
let b64String = "baGVsbG8NCg=="
|
||||
let packetString = "451-[\"test\",{\"test\":{\"_placeholder\":true,\"num\":0}}]"
|
||||
|
||||
socket.on("test") {data, ack in
|
||||
if let data = data[0] as? Data, let string = String(data: data, encoding: .utf8) {
|
||||
XCTAssertEqual(string, "hello")
|
||||
}
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
engine.parseEngineMessage(packetString)
|
||||
engine.parseEngineMessage(b64String)
|
||||
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testSettingExtraHeadersBeforeConnectSetsEngineExtraHeaders() {
|
||||
let newValue = ["hello": "world"]
|
||||
|
||||
manager.engine = engine
|
||||
manager.setTestStatus(.notConnected)
|
||||
manager.config = [.extraHeaders(["new": "value"])]
|
||||
manager.config.insert(.extraHeaders(newValue), replacing: true)
|
||||
|
||||
XCTAssertEqual(2, manager.config.count)
|
||||
XCTAssertEqual(manager.engine!.extraHeaders!, newValue)
|
||||
|
||||
for config in manager.config {
|
||||
switch config {
|
||||
case let .extraHeaders(headers):
|
||||
XCTAssertTrue(headers.keys.contains("hello"), "It should contain hello header key")
|
||||
XCTAssertFalse(headers.keys.contains("new"), "It should not contain old data")
|
||||
case .path:
|
||||
continue
|
||||
default:
|
||||
XCTFail("It should only have two configs")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSettingExtraHeadersAfterConnectDoesNotIgnoreChanges() {
|
||||
let newValue = ["hello": "world"]
|
||||
|
||||
manager.engine = engine
|
||||
manager.setTestStatus(.connected)
|
||||
engine.setConnected(true)
|
||||
manager.config = [.extraHeaders(["new": "value"])]
|
||||
manager.config.insert(.extraHeaders(["hello": "world"]), replacing: true)
|
||||
|
||||
XCTAssertEqual(2, manager.config.count)
|
||||
XCTAssertEqual(manager.engine!.extraHeaders!, newValue)
|
||||
}
|
||||
|
||||
func testSettingPathAfterConnectDoesNotIgnoreChanges() {
|
||||
let newValue = "/newpath/"
|
||||
|
||||
manager.engine = engine
|
||||
manager.setTestStatus(.connected)
|
||||
engine.setConnected(true)
|
||||
manager.config.insert(.path(newValue))
|
||||
|
||||
XCTAssertEqual(1, manager.config.count)
|
||||
XCTAssertEqual(manager.engine!.socketPath, newValue)
|
||||
}
|
||||
|
||||
func testSettingCompressAfterConnectDoesNotIgnoreChanges() {
|
||||
manager.engine = engine
|
||||
manager.setTestStatus(.connected)
|
||||
engine.setConnected(true)
|
||||
manager.config.insert(.compress)
|
||||
|
||||
XCTAssertEqual(2, manager.config.count)
|
||||
XCTAssertTrue(manager.engine!.compress)
|
||||
}
|
||||
|
||||
func testSettingForcePollingAfterConnectDoesNotIgnoreChanges() {
|
||||
manager.engine = engine
|
||||
manager.setTestStatus(.connected)
|
||||
engine.setConnected(true)
|
||||
manager.config.insert(.forcePolling(true))
|
||||
|
||||
XCTAssertEqual(2, manager.config.count)
|
||||
XCTAssertTrue(manager.engine!.forcePolling)
|
||||
}
|
||||
|
||||
func testSettingForceWebSocketsAfterConnectDoesNotIgnoreChanges() {
|
||||
manager.engine = engine
|
||||
manager.setTestStatus(.connected)
|
||||
engine.setConnected(true)
|
||||
manager.config.insert(.forceWebsockets(true))
|
||||
|
||||
XCTAssertEqual(2, manager.config.count)
|
||||
XCTAssertTrue(manager.engine!.forceWebsockets)
|
||||
}
|
||||
|
||||
func testChangingEngineHeadersAfterInit() {
|
||||
engine.extraHeaders = ["Hello": "World"]
|
||||
|
||||
let req = engine.createRequestForPostWithPostWait()
|
||||
|
||||
XCTAssertEqual("World", req.allHTTPHeaderFields?["Hello"])
|
||||
}
|
||||
|
||||
var manager: SocketManager!
|
||||
var socket: SocketIOClient!
|
||||
var engine: SocketEngine!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
manager = SocketManager(socketURL: URL(string: "http://localhost")!)
|
||||
socket = manager.defaultSocket
|
||||
engine = SocketEngine(client: manager, url: URL(string: "http://localhost")!, options: nil)
|
||||
|
||||
socket.setTestable()
|
||||
}
|
||||
}
|
||||
+14
-14
@@ -9,20 +9,12 @@
|
||||
import XCTest
|
||||
import SocketIO
|
||||
|
||||
class TestSocketIOClientConfiguration: XCTestCase {
|
||||
var config = [] as SocketIOClientConfiguration
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
config = [.log(false), .forceNew(true)]
|
||||
}
|
||||
|
||||
class TestSocketIOClientConfiguration : XCTestCase {
|
||||
func testReplaceSameOption() {
|
||||
config.insert(.log(true))
|
||||
|
||||
|
||||
XCTAssertEqual(config.count, 2)
|
||||
|
||||
|
||||
switch config[0] {
|
||||
case let .log(log):
|
||||
XCTAssertTrue(log)
|
||||
@@ -30,12 +22,12 @@ class TestSocketIOClientConfiguration: XCTestCase {
|
||||
XCTFail()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testIgnoreIfExisting() {
|
||||
config.insert(.forceNew(false), replacing: false)
|
||||
|
||||
|
||||
XCTAssertEqual(config.count, 2)
|
||||
|
||||
|
||||
switch config[1] {
|
||||
case let .forceNew(new):
|
||||
XCTAssertTrue(new)
|
||||
@@ -43,4 +35,12 @@ class TestSocketIOClientConfiguration: XCTestCase {
|
||||
XCTFail()
|
||||
}
|
||||
}
|
||||
|
||||
var config = [] as SocketIOClientConfiguration
|
||||
|
||||
override func setUp() {
|
||||
config = [.log(false), .forceNew(true)]
|
||||
|
||||
super.setUp()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
//
|
||||
// Created by Erik Little on 10/21/17.
|
||||
//
|
||||
|
||||
import Dispatch
|
||||
import Foundation
|
||||
@testable import SocketIO
|
||||
import XCTest
|
||||
|
||||
class SocketMangerTest : XCTestCase {
|
||||
func testManagerProperties() {
|
||||
XCTAssertNotNil(manager.defaultSocket)
|
||||
XCTAssertNil(manager.engine)
|
||||
XCTAssertFalse(manager.forceNew)
|
||||
XCTAssertEqual(manager.handleQueue, DispatchQueue.main)
|
||||
XCTAssertTrue(manager.reconnects)
|
||||
XCTAssertEqual(manager.reconnectWait, 10)
|
||||
XCTAssertEqual(manager.reconnectWaitMax, 30)
|
||||
XCTAssertEqual(manager.randomizationFactor, 0.5)
|
||||
XCTAssertEqual(manager.status, .notConnected)
|
||||
}
|
||||
|
||||
func testSettingConfig() {
|
||||
let manager = SocketManager(socketURL: URL(string: "https://example.com/")!)
|
||||
|
||||
XCTAssertEqual(manager.config.first!, .secure(true))
|
||||
|
||||
manager.config = []
|
||||
|
||||
XCTAssertEqual(manager.config.first!, .secure(true))
|
||||
}
|
||||
|
||||
func testBackoffIntervalCalulation() {
|
||||
XCTAssertLessThanOrEqual(manager.reconnectInterval(attempts: -1), Double(manager.reconnectWaitMax))
|
||||
XCTAssertLessThanOrEqual(manager.reconnectInterval(attempts: 0), 15)
|
||||
XCTAssertLessThanOrEqual(manager.reconnectInterval(attempts: 1), 22.5)
|
||||
XCTAssertLessThanOrEqual(manager.reconnectInterval(attempts: 2), 33.75)
|
||||
XCTAssertLessThanOrEqual(manager.reconnectInterval(attempts: 50), Double(manager.reconnectWaitMax))
|
||||
XCTAssertLessThanOrEqual(manager.reconnectInterval(attempts: 10000), Double(manager.reconnectWaitMax))
|
||||
|
||||
XCTAssertGreaterThanOrEqual(manager.reconnectInterval(attempts: -1), Double(manager.reconnectWait))
|
||||
XCTAssertGreaterThanOrEqual(manager.reconnectInterval(attempts: 0), Double(manager.reconnectWait))
|
||||
XCTAssertGreaterThanOrEqual(manager.reconnectInterval(attempts: 1), 15)
|
||||
XCTAssertGreaterThanOrEqual(manager.reconnectInterval(attempts: 2), 22.5)
|
||||
XCTAssertGreaterThanOrEqual(manager.reconnectInterval(attempts: 10000), Double(manager.reconnectWait))
|
||||
}
|
||||
|
||||
func testManagerCallsConnect() {
|
||||
setUpSockets()
|
||||
|
||||
socket.expectations[ManagerExpectation.didConnectCalled] = expectation(description: "The manager should call connect on the default socket")
|
||||
socket2.expectations[ManagerExpectation.didConnectCalled] = expectation(description: "The manager should call connect on the socket")
|
||||
|
||||
socket.connect()
|
||||
socket2.connect()
|
||||
|
||||
manager.fakeConnecting()
|
||||
manager.fakeConnecting(toNamespace: "/swift")
|
||||
|
||||
waitForExpectations(timeout: 0.3)
|
||||
}
|
||||
|
||||
func testManagerDoesNotCallConnectWhenConnectingWithLessThanOneReconnect() {
|
||||
setUpSockets()
|
||||
|
||||
let expect = expectation(description: "The manager should not call connect on the engine")
|
||||
expect.isInverted = true
|
||||
|
||||
let engine = TestEngine(client: manager, url: manager.socketURL, options: nil)
|
||||
|
||||
engine.onConnect = {
|
||||
expect.fulfill()
|
||||
}
|
||||
manager.setTestStatus(.connecting)
|
||||
manager.setCurrentReconnect(currentReconnect: 0)
|
||||
manager.engine = engine
|
||||
|
||||
manager.connect()
|
||||
|
||||
waitForExpectations(timeout: 0.3)
|
||||
}
|
||||
|
||||
func testManagerCallConnectWhenConnectingAndMoreThanOneReconnect() {
|
||||
setUpSockets()
|
||||
|
||||
let expect = expectation(description: "The manager should call connect on the engine")
|
||||
let engine = TestEngine(client: manager, url: manager.socketURL, options: nil)
|
||||
|
||||
engine.onConnect = {
|
||||
expect.fulfill()
|
||||
}
|
||||
manager.setTestStatus(.connecting)
|
||||
manager.setCurrentReconnect(currentReconnect: 1)
|
||||
manager.engine = engine
|
||||
|
||||
manager.connect()
|
||||
|
||||
waitForExpectations(timeout: 0.8)
|
||||
}
|
||||
|
||||
func testManagerCallsDisconnect() {
|
||||
setUpSockets()
|
||||
|
||||
socket.expectations[ManagerExpectation.didDisconnectCalled] = expectation(description: "The manager should call disconnect on the default socket")
|
||||
socket2.expectations[ManagerExpectation.didDisconnectCalled] = expectation(description: "The manager should call disconnect on the socket")
|
||||
|
||||
socket2.on(clientEvent: .connect) {data, ack in
|
||||
self.manager.disconnect()
|
||||
self.manager.fakeDisconnecting()
|
||||
}
|
||||
|
||||
socket.connect()
|
||||
socket2.connect()
|
||||
|
||||
manager.fakeConnecting()
|
||||
manager.fakeConnecting(toNamespace: "/swift")
|
||||
|
||||
waitForExpectations(timeout: 0.3)
|
||||
}
|
||||
|
||||
// func testManagerEmitAll() {
|
||||
// setUpSockets()
|
||||
//
|
||||
// socket.expectations[ManagerExpectation.emitAllEventCalled] = expectation(description: "The manager should emit an event to the default socket")
|
||||
// socket2.expectations[ManagerExpectation.emitAllEventCalled] = expectation(description: "The manager should emit an event to the socket")
|
||||
//
|
||||
// socket2.on(clientEvent: .connect) {data, ack in
|
||||
// print("connect")
|
||||
// self.manager.emitAll("event", "testing")
|
||||
// }
|
||||
//
|
||||
// socket.connect()
|
||||
// socket2.connect()
|
||||
//
|
||||
// manager.fakeConnecting(toNamespace: "/swift")
|
||||
//
|
||||
// waitForExpectations(timeout: 0.3)
|
||||
// }
|
||||
|
||||
func testManagerSetsConfigs() {
|
||||
let queue = DispatchQueue(label: "testQueue")
|
||||
|
||||
manager = TestManager(socketURL: URL(string: "http://localhost/")!, config: [
|
||||
.handleQueue(queue),
|
||||
.forceNew(true),
|
||||
.reconnects(false),
|
||||
.reconnectWait(5),
|
||||
.reconnectWaitMax(5),
|
||||
.randomizationFactor(0.7),
|
||||
.reconnectAttempts(5)
|
||||
])
|
||||
|
||||
XCTAssertEqual(manager.handleQueue, queue)
|
||||
XCTAssertTrue(manager.forceNew)
|
||||
XCTAssertFalse(manager.reconnects)
|
||||
XCTAssertEqual(manager.reconnectWait, 5)
|
||||
XCTAssertEqual(manager.reconnectWaitMax, 5)
|
||||
XCTAssertEqual(manager.randomizationFactor, 0.7)
|
||||
XCTAssertEqual(manager.reconnectAttempts, 5)
|
||||
}
|
||||
|
||||
func testManagerRemovesSocket() {
|
||||
setUpSockets()
|
||||
|
||||
manager.removeSocket(socket)
|
||||
|
||||
XCTAssertNil(manager.nsps[socket.nsp])
|
||||
}
|
||||
|
||||
private func setUpSockets() {
|
||||
socket = manager.testSocket(forNamespace: "/")
|
||||
socket2 = manager.testSocket(forNamespace: "/swift")
|
||||
}
|
||||
|
||||
private var manager: TestManager!
|
||||
private var socket: TestSocket!
|
||||
private var socket2: TestSocket!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
manager = TestManager(socketURL: URL(string: "http://localhost/")!, config: [.log(false)])
|
||||
socket = nil
|
||||
socket2 = nil
|
||||
}
|
||||
}
|
||||
|
||||
public enum ManagerExpectation: String {
|
||||
case didConnectCalled
|
||||
case didDisconnectCalled
|
||||
case emitAllEventCalled
|
||||
}
|
||||
|
||||
public class TestManager: SocketManager {
|
||||
public func setCurrentReconnect(currentReconnect: Int) {
|
||||
self.currentReconnectAttempt = currentReconnect
|
||||
}
|
||||
|
||||
public override func disconnect() {
|
||||
setTestStatus(.disconnected)
|
||||
}
|
||||
|
||||
public func testSocket(forNamespace nsp: String) -> TestSocket {
|
||||
return socket(forNamespace: nsp) as! TestSocket
|
||||
}
|
||||
|
||||
public func fakeDisconnecting() {
|
||||
engineDidClose(reason: "")
|
||||
}
|
||||
|
||||
public func fakeConnecting(toNamespace nsp: String = "/") {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
// Fake connecting
|
||||
self.parseEngineMessage("0\(nsp)")
|
||||
}
|
||||
}
|
||||
|
||||
public override func socket(forNamespace nsp: String) -> SocketIOClient {
|
||||
// set socket to our test socket, the superclass method will get this from nsps
|
||||
nsps[nsp] = TestSocket(manager: self, nsp: nsp)
|
||||
|
||||
return super.socket(forNamespace: nsp)
|
||||
}
|
||||
}
|
||||
|
||||
public class TestSocket: SocketIOClient {
|
||||
public var expectations = [ManagerExpectation: XCTestExpectation]()
|
||||
|
||||
public override func didConnect(toNamespace nsp: String, payload: [String: Any]?) {
|
||||
expectations[ManagerExpectation.didConnectCalled]?.fulfill()
|
||||
expectations[ManagerExpectation.didConnectCalled] = nil
|
||||
|
||||
super.didConnect(toNamespace: nsp, payload: payload)
|
||||
}
|
||||
|
||||
public override func didDisconnect(reason: String) {
|
||||
expectations[ManagerExpectation.didDisconnectCalled]?.fulfill()
|
||||
expectations[ManagerExpectation.didDisconnectCalled] = nil
|
||||
|
||||
super.didDisconnect(reason: reason)
|
||||
}
|
||||
|
||||
public override func emit(_ event: String, _ items: SocketData..., completion: (() -> ())? = nil) {
|
||||
expectations[ManagerExpectation.emitAllEventCalled]?.fulfill()
|
||||
expectations[ManagerExpectation.emitAllEventCalled] = nil
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
//
|
||||
// SocketNamespacePacketTest.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SocketIO
|
||||
|
||||
class SocketNamespacePacketTest : XCTestCase {
|
||||
func testEmptyEmit() {
|
||||
let sendData: [Any] = ["test"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testNullEmit() {
|
||||
let sendData: [Any] = ["test", NSNull()]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testStringEmit() {
|
||||
let sendData: [Any] = ["test", "foo bar"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testJSONEmit() {
|
||||
let sendData: [Any] = ["test", ["foobar": true, "hello": 1, "test": "hello", "null": NSNull()] as NSDictionary]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testArrayEmit() {
|
||||
let sendData: [Any] = ["test", ["hello", 1, ["test": "test"], true]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testBinaryEmit() {
|
||||
let sendData: [Any] = ["test", data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .binaryEvent)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertEqual(packet.binary, [data])
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: [
|
||||
"test",
|
||||
["_placeholder": true, "num": 0]
|
||||
]))
|
||||
}
|
||||
|
||||
func testMultipleBinaryEmit() {
|
||||
let sendData: [Any] = ["test", ["data1": data, "data2": data2] as NSDictionary]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: -1, nsp: "/swift", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .binaryEvent)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
|
||||
let binaryObj = parsed.data[1] as! [String: Any]
|
||||
let data1Loc = (binaryObj["data1"] as! [String: Any])["num"] as! Int
|
||||
let data2Loc = (binaryObj["data2"] as! [String: Any])["num"] as! Int
|
||||
|
||||
XCTAssertEqual(packet.binary[data1Loc], data)
|
||||
XCTAssertEqual(packet.binary[data2Loc], data2)
|
||||
}
|
||||
|
||||
func testEmitWithAck() {
|
||||
let sendData = ["test"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .event)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testEmitDataWithAck() {
|
||||
let sendData: [Any] = ["test", data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: false)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .binaryEvent)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: [
|
||||
"test",
|
||||
["_placeholder": true, "num": 0]
|
||||
]))
|
||||
}
|
||||
|
||||
// Acks
|
||||
func testEmptyAck() {
|
||||
let packet = SocketPacket.packetFromEmit([], id: 0, nsp: "/swift", ack: true)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .ack)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
}
|
||||
|
||||
func testNullAck() {
|
||||
let sendData = [NSNull()]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .ack)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testStringAck() {
|
||||
let sendData = ["test"]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .ack)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testJSONAck() {
|
||||
let sendData = [["foobar": true, "hello": 1, "test": "hello", "null": NSNull()]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .ack)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: sendData))
|
||||
}
|
||||
|
||||
func testBinaryAck() {
|
||||
let sendData = [data]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .binaryAck)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
XCTAssertTrue(compareAnyArray(input: parsed.data, expected: [
|
||||
["_placeholder": true, "num": 0]
|
||||
]))
|
||||
}
|
||||
|
||||
func testMultipleBinaryAck() {
|
||||
let sendData = [["data1": data, "data2": data2]]
|
||||
let packet = SocketPacket.packetFromEmit(sendData, id: 0, nsp: "/swift", ack: true)
|
||||
let parsed = parser.parseSocketMessage(packet.packetString)!
|
||||
|
||||
XCTAssertEqual(parsed.type, .binaryAck)
|
||||
XCTAssertEqual(parsed.nsp, "/swift")
|
||||
XCTAssertEqual(parsed.id, 0)
|
||||
|
||||
let binaryObj = parsed.data[0] as! [String: Any]
|
||||
let data1Loc = (binaryObj["data1"] as! [String: Any])["num"] as! Int
|
||||
let data2Loc = (binaryObj["data2"] as! [String: Any])["num"] as! Int
|
||||
|
||||
XCTAssertEqual(packet.binary[data1Loc], data)
|
||||
XCTAssertEqual(packet.binary[data2Loc], data2)
|
||||
}
|
||||
|
||||
let data = "test".data(using: String.Encoding.utf8)!
|
||||
let data2 = "test2".data(using: String.Encoding.utf8)!
|
||||
var parser: SocketParsable!
|
||||
|
||||
private func compareAnyArray(input: [Any], expected: [Any]) -> Bool {
|
||||
guard input.count == expected.count else { return false }
|
||||
|
||||
return (input as NSArray).isEqual(to: expected)
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
parser = SocketManager(socketURL: URL(string: "http://localhost")!)
|
||||
}
|
||||
}
|
||||
+52
-54
@@ -10,26 +10,6 @@ import XCTest
|
||||
@testable import SocketIO
|
||||
|
||||
class SocketParserTest: XCTestCase {
|
||||
let testSocket = SocketIOClient(socketURL: URL(string: "http://localhost/")!)
|
||||
|
||||
//Format key: message; namespace-data-binary-id
|
||||
static let packetTypes: [String: (String, [Any], [Data], Int)] = [
|
||||
"0": ("/", [], [], -1), "1": ("/", [], [], -1),
|
||||
"25[\"test\"]": ("/", ["test"], [], 5),
|
||||
"2[\"test\",\"~~0\"]": ("/", ["test", "~~0"], [], -1),
|
||||
"2/swift,[\"testArrayEmitReturn\",[\"test3\",\"test4\"]]": ("/swift", ["testArrayEmitReturn", ["test3", "test4"] as NSArray], [], -1),
|
||||
"51-/swift,[\"testMultipleItemsWithBufferEmitReturn\",[1,2],{\"test\":\"bob\"},25,\"polo\",{\"_placeholder\":true,\"num\":0}]": ("/swift", ["testMultipleItemsWithBufferEmitReturn", [1, 2] as NSArray, ["test": "bob"] as NSDictionary, 25, "polo", ["_placeholder": true, "num": 0] as NSDictionary], [], -1),
|
||||
"3/swift,0[[\"test3\",\"test4\"]]": ("/swift", [["test3", "test4"] as NSArray], [], 0),
|
||||
"61-/swift,19[[1,2],{\"test\":\"bob\"},25,\"polo\",{\"_placeholder\":true,\"num\":0}]":
|
||||
("/swift", [ [1, 2] as NSArray, ["test": "bob"] as NSDictionary, 25, "polo", ["_placeholder": true, "num": 0] as NSDictionary], [], 19),
|
||||
"4/swift,": ("/swift", [], [], -1),
|
||||
"0/swift": ("/swift", [], [], -1),
|
||||
"1/swift": ("/swift", [], [], -1),
|
||||
"4\"ERROR\"": ("/", ["ERROR"], [], -1),
|
||||
"4{\"test\":2}": ("/", [["test": 2]], [], -1),
|
||||
"41": ("/", [1], [], -1),
|
||||
"4[1, \"hello\"]": ("/", [1, "hello"], [], -1)]
|
||||
|
||||
func testDisconnect() {
|
||||
let message = "1"
|
||||
validateParseResult(message)
|
||||
@@ -39,82 +19,82 @@ class SocketParserTest: XCTestCase {
|
||||
let message = "0"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testDisconnectNameSpace() {
|
||||
let message = "1/swift"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testConnecttNameSpace() {
|
||||
let message = "0/swift"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testIdEvent() {
|
||||
let message = "25[\"test\"]"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testBinaryPlaceholderAsString() {
|
||||
let message = "2[\"test\",\"~~0\"]"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testNameSpaceArrayParse() {
|
||||
let message = "2/swift,[\"testArrayEmitReturn\",[\"test3\",\"test4\"]]"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testNameSpaceArrayAckParse() {
|
||||
let message = "3/swift,0[[\"test3\",\"test4\"]]"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testNameSpaceBinaryEventParse() {
|
||||
let message = "51-/swift,[\"testMultipleItemsWithBufferEmitReturn\",[1,2],{\"test\":\"bob\"},25,\"polo\",{\"_placeholder\":true,\"num\":0}]"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testNameSpaceBinaryAckParse() {
|
||||
let message = "61-/swift,19[[1,2],{\"test\":\"bob\"},25,\"polo\",{\"_placeholder\":true,\"num\":0}]"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testNamespaceErrorParse() {
|
||||
let message = "4/swift,"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testErrorTypeString() {
|
||||
let message = "4\"ERROR\""
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testErrorTypeDictionary() {
|
||||
let message = "4{\"test\":2}"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testErrorTypeInt() {
|
||||
let message = "41"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testErrorTypeArray() {
|
||||
let message = "4[1, \"hello\"]"
|
||||
validateParseResult(message)
|
||||
}
|
||||
|
||||
|
||||
func testInvalidInput() {
|
||||
let message = "8"
|
||||
switch testSocket.parseString(message) {
|
||||
case .left(_):
|
||||
return
|
||||
case .right(_):
|
||||
XCTFail("Created packet when shouldn't have")
|
||||
do {
|
||||
let _ = try testManager.parseString(message)
|
||||
XCTFail()
|
||||
} catch {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testGenericParser() {
|
||||
var parser = SocketStringReader(message: "61-/swift,")
|
||||
XCTAssertEqual(parser.read(count: 1), "6")
|
||||
@@ -122,28 +102,46 @@ class SocketParserTest: XCTestCase {
|
||||
XCTAssertEqual(parser.readUntilOccurence(of: "-"), "1")
|
||||
XCTAssertEqual(parser.currentCharacter, "/")
|
||||
}
|
||||
|
||||
|
||||
func validateParseResult(_ message: String) {
|
||||
let validValues = SocketParserTest.packetTypes[message]!
|
||||
let packet = testSocket.parseString(message)
|
||||
let type = String(message.characters.prefix(1))
|
||||
if case let .right(packet) = packet {
|
||||
XCTAssertEqual(packet.type, SocketPacket.PacketType(rawValue: Int(type) ?? -1)!)
|
||||
XCTAssertEqual(packet.nsp, validValues.0)
|
||||
XCTAssertTrue((packet.data as NSArray).isEqual(to: validValues.1), "\(packet.data)")
|
||||
XCTAssertTrue((packet.binary as NSArray).isEqual(to: validValues.2), "\(packet.binary)")
|
||||
XCTAssertEqual(packet.id, validValues.3)
|
||||
} else {
|
||||
XCTFail()
|
||||
}
|
||||
let packet = try! testManager.parseString(message)
|
||||
let type = String(message.prefix(1))
|
||||
|
||||
XCTAssertEqual(packet.type, SocketPacket.PacketType(rawValue: Int(type) ?? -1)!)
|
||||
XCTAssertEqual(packet.nsp, validValues.0)
|
||||
XCTAssertTrue((packet.data as NSArray).isEqual(to: validValues.1), "\(packet.data)")
|
||||
XCTAssertTrue((packet.binary as NSArray).isEqual(to: validValues.2), "\(packet.binary)")
|
||||
XCTAssertEqual(packet.id, validValues.3)
|
||||
}
|
||||
|
||||
|
||||
func testParsePerformance() {
|
||||
let keys = Array(SocketParserTest.packetTypes.keys)
|
||||
measure {
|
||||
for item in keys.enumerated() {
|
||||
_ = self.testSocket.parseString(item.element)
|
||||
_ = try! self.testManager.parseString(item.element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let testManager = SocketManager(socketURL: URL(string: "http://localhost/")!)
|
||||
|
||||
//Format key: message; namespace-data-binary-id
|
||||
static let packetTypes: [String: (String, [Any], [Data], Int)] = [
|
||||
"0": ("/", [], [], -1), "1": ("/", [], [], -1),
|
||||
"25[\"test\"]": ("/", ["test"], [], 5),
|
||||
"2[\"test\",\"~~0\"]": ("/", ["test", "~~0"], [], -1),
|
||||
"2/swift,[\"testArrayEmitReturn\",[\"test3\",\"test4\"]]": ("/swift", ["testArrayEmitReturn", ["test3", "test4"] as NSArray], [], -1),
|
||||
"51-/swift,[\"testMultipleItemsWithBufferEmitReturn\",[1,2],{\"test\":\"bob\"},25,\"polo\",{\"_placeholder\":true,\"num\":0}]": ("/swift", ["testMultipleItemsWithBufferEmitReturn", [1, 2] as NSArray, ["test": "bob"] as NSDictionary, 25, "polo", ["_placeholder": true, "num": 0] as NSDictionary], [], -1),
|
||||
"3/swift,0[[\"test3\",\"test4\"]]": ("/swift", [["test3", "test4"] as NSArray], [], 0),
|
||||
"61-/swift,19[[1,2],{\"test\":\"bob\"},25,\"polo\",{\"_placeholder\":true,\"num\":0}]":
|
||||
("/swift", [ [1, 2] as NSArray, ["test": "bob"] as NSDictionary, 25, "polo", ["_placeholder": true, "num": 0] as NSDictionary], [], 19),
|
||||
"4/swift,": ("/swift", [], [], -1),
|
||||
"0/swift": ("/swift", [], [], -1),
|
||||
"1/swift": ("/swift", [], [], -1),
|
||||
"4\"ERROR\"": ("/", ["ERROR"], [], -1),
|
||||
"4{\"test\":2}": ("/", [["test": 2]], [], -1),
|
||||
"41": ("/", [1], [], -1),
|
||||
"4[1, \"hello\"]": ("/", [1, "hello"], [], -1)
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,507 @@
|
||||
//
|
||||
// SocketSideEffectTest.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SocketIO
|
||||
import Starscream
|
||||
|
||||
class SocketSideEffectTest: XCTestCase {
|
||||
func testInitialCurrentAck() {
|
||||
XCTAssertEqual(socket.currentAck, -1)
|
||||
}
|
||||
|
||||
func testFirstAck() {
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in}
|
||||
XCTAssertEqual(socket.currentAck, 0)
|
||||
}
|
||||
|
||||
func testSecondAck() {
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in}
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in}
|
||||
|
||||
XCTAssertEqual(socket.currentAck, 1)
|
||||
}
|
||||
|
||||
func testEmitCompletionSyntax() {
|
||||
socket.emit("test", completion: {})
|
||||
socket.emit("test", "thing", completion: {})
|
||||
}
|
||||
|
||||
func testHandleAck() {
|
||||
let expect = expectation(description: "handled ack")
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in
|
||||
XCTAssertEqual(data[0] as? String, "hello world")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
manager.parseEngineMessage("30[\"hello world\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleAckWithAckEmit() {
|
||||
let expect = expectation(description: "handled ack")
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in
|
||||
XCTAssertEqual(data[0] as? String, "hello world")
|
||||
|
||||
self.socket.emitWithAck("test").timingOut(after: 0) {data in}
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
manager.parseEngineMessage("30[\"hello world\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleAck2() {
|
||||
let expect = expectation(description: "handled ack2")
|
||||
socket.emitWithAck("test").timingOut(after: 0) {data in
|
||||
XCTAssertTrue(data.count == 2, "Wrong number of ack items")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
manager.parseEngineMessage("61-0[{\"_placeholder\":true,\"num\":0},{\"test\":true}]")
|
||||
manager.parseEngineBinaryData(Data())
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleEvent() {
|
||||
let expect = expectation(description: "handled event")
|
||||
socket.on("test") {data, ack in
|
||||
XCTAssertEqual(data[0] as? String, "hello world")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
manager.parseEngineMessage("2[\"test\",\"hello world\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleStringEventWithQuotes() {
|
||||
let expect = expectation(description: "handled event")
|
||||
socket.on("test") {data, ack in
|
||||
XCTAssertEqual(data[0] as? String, "\"hello world\"")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
manager.parseEngineMessage("2[\"test\",\"\\\"hello world\\\"\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleOnceEvent() {
|
||||
let expect = expectation(description: "handled event")
|
||||
socket.once("test") {data, ack in
|
||||
XCTAssertEqual(data[0] as? String, "hello world")
|
||||
XCTAssertEqual(self.socket.testHandlers.count, 0)
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
manager.parseEngineMessage("2[\"test\",\"hello world\"]")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleOnceClientEvent() {
|
||||
let expect = expectation(description: "handled event")
|
||||
|
||||
socket.setTestStatus(.connecting)
|
||||
|
||||
socket.once(clientEvent: .connect) {data, ack in
|
||||
XCTAssertEqual(self.socket.testHandlers.count, 0)
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
|
||||
// Fake connecting
|
||||
self.manager.parseEngineMessage("0/")
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testOffWithEvent() {
|
||||
socket.on("test") {data, ack in }
|
||||
socket.on("test") {data, ack in }
|
||||
XCTAssertEqual(socket.testHandlers.count, 2)
|
||||
socket.off("test")
|
||||
XCTAssertEqual(socket.testHandlers.count, 0)
|
||||
}
|
||||
|
||||
func testOffClientEvent() {
|
||||
socket.on(clientEvent: .connect) {data, ack in }
|
||||
socket.on(clientEvent: .disconnect) {data, ack in }
|
||||
XCTAssertEqual(socket.testHandlers.count, 2)
|
||||
socket.off(clientEvent: .disconnect)
|
||||
XCTAssertEqual(socket.testHandlers.count, 1)
|
||||
XCTAssertTrue(socket.testHandlers.contains(where: { $0.event == "connect" }))
|
||||
}
|
||||
|
||||
func testOffWithId() {
|
||||
let handler = socket.on("test") {data, ack in }
|
||||
XCTAssertEqual(socket.testHandlers.count, 1)
|
||||
socket.on("test") {data, ack in }
|
||||
XCTAssertEqual(socket.testHandlers.count, 2)
|
||||
socket.off(id: handler)
|
||||
XCTAssertEqual(socket.testHandlers.count, 1)
|
||||
}
|
||||
|
||||
func testHandlesErrorPacket() {
|
||||
let expect = expectation(description: "Handled error")
|
||||
socket.on("error") {data, ack in
|
||||
if let error = data[0] as? String, error == "test error" {
|
||||
expect.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
manager.parseEngineMessage("4\"test error\"")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleBinaryEvent() {
|
||||
let expect = expectation(description: "handled binary event")
|
||||
socket.on("test") {data, ack in
|
||||
if let dict = data[0] as? [String: Any], let data = dict["test"] as? Data {
|
||||
XCTAssertEqual(data as Data, self.data)
|
||||
expect.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
manager.parseEngineMessage("51-[\"test\",{\"test\":{\"_placeholder\":true,\"num\":0}}]")
|
||||
manager.parseEngineBinaryData(data)
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testHandleMultipleBinaryEvent() {
|
||||
let expect = expectation(description: "handled multiple binary event")
|
||||
socket.on("test") {data, ack in
|
||||
if let dict = data[0] as? [String: Any], let data = dict["test"] as? Data,
|
||||
let data2 = dict["test2"] as? Data {
|
||||
XCTAssertEqual(data as Data, self.data)
|
||||
XCTAssertEqual(data2 as Data, self.data2)
|
||||
expect.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
manager.parseEngineMessage("52-[\"test\",{\"test\":{\"_placeholder\":true,\"num\":0},\"test2\":{\"_placeholder\":true,\"num\":1}}]")
|
||||
manager.parseEngineBinaryData(data)
|
||||
manager.parseEngineBinaryData(data2)
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
func testChangingStatusCallsStatusChangeHandler() {
|
||||
let expect = expectation(description: "The client should announce when the status changes")
|
||||
let statusChange = SocketIOStatus.connecting
|
||||
|
||||
socket.on("statusChange") {data, ack in
|
||||
guard let status = data[0] as? SocketIOStatus else {
|
||||
XCTFail("Status should be one of the defined statuses")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(status, statusChange, "The status changed should be the one set")
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.setTestStatus(statusChange)
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testOnClientEvent() {
|
||||
let expect = expectation(description: "The client should call client event handlers")
|
||||
let event = SocketClientEvent.disconnect
|
||||
let closeReason = "testing"
|
||||
|
||||
socket.on(clientEvent: event) {data, ack in
|
||||
guard let reason = data[0] as? String else {
|
||||
XCTFail("Client should pass data for client events")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(closeReason, reason, "The data should be what was sent to handleClientEvent")
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.handleClientEvent(event, data: [closeReason])
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testClientEventsAreBackwardsCompatible() {
|
||||
let expect = expectation(description: "The client should call old style client event handlers")
|
||||
let event = SocketClientEvent.disconnect
|
||||
let closeReason = "testing"
|
||||
|
||||
socket.on("disconnect") {data, ack in
|
||||
guard let reason = data[0] as? String else {
|
||||
XCTFail("Client should pass data for client events")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(closeReason, reason, "The data should be what was sent to handleClientEvent")
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.handleClientEvent(event, data: [closeReason])
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testConnectTimesOutIfNotConnected() {
|
||||
let expect = expectation(description: "The client should call the timeout function")
|
||||
|
||||
socket = manager.socket(forNamespace: "/someNamespace")
|
||||
socket.setTestStatus(.notConnected)
|
||||
manager.engine = TestEngine(client: manager, url: manager.socketURL, options: nil)
|
||||
|
||||
socket.connect(timeoutAfter: 0.5, withHandler: {
|
||||
expect.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 0.8)
|
||||
}
|
||||
|
||||
func testConnectDoesNotTimeOutIfConnected() {
|
||||
let expect = expectation(description: "The client should not call the timeout function")
|
||||
|
||||
socket.setTestStatus(.notConnected)
|
||||
manager.engine = TestEngine(client: manager, url: manager.socketURL, options: nil)
|
||||
|
||||
socket.on(clientEvent: .connect) {data, ack in
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.connect(timeoutAfter: 0.5, withHandler: {
|
||||
XCTFail("Should not call timeout handler if status is connected")
|
||||
})
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
|
||||
// Fake connecting
|
||||
self.manager.parseEngineMessage("0/")
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 2)
|
||||
}
|
||||
|
||||
func testClientCallsConnectOnEngineOpen() {
|
||||
let expect = expectation(description: "The client call the connect handler")
|
||||
let eng = TestEngine(client: manager, url: manager.socketURL, options: nil)
|
||||
|
||||
eng.onConnect = {
|
||||
self.socket.didConnect(toNamespace: self.socket.nsp, payload: nil)
|
||||
}
|
||||
|
||||
manager.engine = eng
|
||||
socket.setTestStatus(.notConnected)
|
||||
|
||||
socket.on(clientEvent: .connect) {data, ack in
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.connect(timeoutAfter: 0.5, withHandler: {
|
||||
XCTFail("Should not call timeout handler if status is connected")
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 2)
|
||||
}
|
||||
|
||||
func testConnectIsCalledWithNamespace() {
|
||||
let expect = expectation(description: "The client should not call the timeout function")
|
||||
let nspString = "/swift"
|
||||
|
||||
socket = manager.socket(forNamespace: "/swift")
|
||||
socket.setTestStatus(.notConnected)
|
||||
manager.engine = TestEngine(client: manager, url: manager.socketURL, options: nil)
|
||||
|
||||
socket.on(clientEvent: .connect) {data, ack in
|
||||
guard let nsp = data[0] as? String else {
|
||||
XCTFail("Connect should be called with a namespace")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(nspString, nsp, "It should connect with the correct namespace")
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.connect(timeoutAfter: 0.3, withHandler: {
|
||||
XCTFail("Should not call timeout handler if status is connected")
|
||||
})
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
|
||||
// Fake connecting
|
||||
self.manager.parseEngineMessage("0/swift")
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 2)
|
||||
}
|
||||
|
||||
func testErrorInCustomSocketDataCallsErrorHandler() {
|
||||
let expect = expectation(description: "The client should call the error handler for emit errors because of " +
|
||||
"custom data")
|
||||
|
||||
socket.on(clientEvent: .error) {data, ack in
|
||||
guard data.count == 3, data[0] as? String == "myEvent",
|
||||
data[2] is ThrowingData.ThrowingError else {
|
||||
XCTFail("Incorrect error call")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.emit("myEvent", ThrowingData())
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testErrorInCustomSocketDataCallsErrorHandler_ack() {
|
||||
let expect = expectation(description: "The client should call the error handler for emit errors because of " +
|
||||
"custom data")
|
||||
|
||||
socket.on(clientEvent: .error) {data, ack in
|
||||
guard data.count == 3, data[0] as? String == "myEvent",
|
||||
data[2] is ThrowingData.ThrowingError else {
|
||||
XCTFail("Incorrect error call")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
socket.emitWithAck("myEvent", ThrowingData()).timingOut(after: 0.8, callback: {_ in
|
||||
XCTFail("Ack callback should not be called")
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testSettingConfigAfterInit() {
|
||||
socket.setTestStatus(.notConnected)
|
||||
manager.config.insert(.log(true))
|
||||
|
||||
XCTAssertTrue(DefaultSocketLogger.Logger.log, "It should set logging to true after creation")
|
||||
|
||||
manager.config = [.log(false)]
|
||||
|
||||
XCTAssertFalse(DefaultSocketLogger.Logger.log, "It should set logging to false after creation")
|
||||
}
|
||||
|
||||
func testSettingConfigAfterDisconnect() {
|
||||
socket.setTestStatus(.disconnected)
|
||||
manager.config.insert(.log(true))
|
||||
|
||||
XCTAssertTrue(DefaultSocketLogger.Logger.log, "It should set logging to true after creation")
|
||||
|
||||
manager.config = [.log(false)]
|
||||
|
||||
XCTAssertFalse(DefaultSocketLogger.Logger.log, "It should set logging to false after creation")
|
||||
}
|
||||
|
||||
func testSettingConfigAfterInitWhenConnectedDoesNotIgnoreChanges() {
|
||||
manager.setTestStatus(.connected)
|
||||
manager.config = [.log(true)]
|
||||
|
||||
XCTAssertTrue(DefaultSocketLogger.Logger.log, "It should set logging to false after creation")
|
||||
}
|
||||
|
||||
func testClientCallsSentPingHandler() {
|
||||
let expect = expectation(description: "The client should emit a ping event")
|
||||
|
||||
socket.on(clientEvent: .pong) {data, ack in
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
manager.engineDidSendPong()
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
func testClientCallsGotPongHandler() {
|
||||
let expect = expectation(description: "The client should emit a pong event")
|
||||
|
||||
socket.on(clientEvent: .ping) {data, ack in
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
manager.engineDidReceivePing()
|
||||
|
||||
waitForExpectations(timeout: 0.2)
|
||||
}
|
||||
|
||||
let data = "test".data(using: String.Encoding.utf8)!
|
||||
let data2 = "test2".data(using: String.Encoding.utf8)!
|
||||
|
||||
private var manager: SocketManager!
|
||||
private var socket: SocketIOClient!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
manager = SocketManager(socketURL: URL(string: "http://localhost/")!, config: [.log(false)])
|
||||
socket = manager.defaultSocket
|
||||
socket.setTestable()
|
||||
}
|
||||
}
|
||||
|
||||
struct ThrowingData: SocketData {
|
||||
enum ThrowingError : Error {
|
||||
case error
|
||||
}
|
||||
|
||||
func socketRepresentation() throws -> SocketData {
|
||||
throw ThrowingError.error
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TestEngine: SocketEngineSpec {
|
||||
weak var client: SocketEngineClient?
|
||||
private(set) var closed = false
|
||||
private(set) var compress = false
|
||||
private(set) var connected = false
|
||||
var connectParams: [String: Any]? = nil
|
||||
private(set) var cookies: [HTTPCookie]? = nil
|
||||
private(set) var engineQueue = DispatchQueue.main
|
||||
var extraHeaders: [String: String]? = nil
|
||||
private(set) var fastUpgrade = false
|
||||
private(set) var forcePolling = false
|
||||
private(set) var forceWebsockets = false
|
||||
private(set) var polling = false
|
||||
private(set) var probing = false
|
||||
private(set) var sid = ""
|
||||
private(set) var socketPath = ""
|
||||
private(set) var urlPolling = URL(string: "http://localhost/")!
|
||||
private(set) var urlWebSocket = URL(string: "http://localhost/")!
|
||||
private(set) var websocket = false
|
||||
private(set) var ws: WebSocket? = nil
|
||||
private(set) var version = SocketIOVersion.three
|
||||
|
||||
internal var onConnect: (() -> ())?
|
||||
|
||||
required init(client: SocketEngineClient, url: URL, options: [String: Any]?) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
func connect() {
|
||||
onConnect?()
|
||||
}
|
||||
|
||||
func didError(reason: String) { }
|
||||
func disconnect(reason: String) { }
|
||||
func doFastUpgrade() { }
|
||||
func flushWaitingForPostToWebSocket() { }
|
||||
func parseEngineData(_ data: Data) { }
|
||||
func parseEngineMessage(_ message: String) { }
|
||||
func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data], completion: (() -> ())?) { }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Created by Erik Little on 2019-01-11.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@testable import SocketIO
|
||||
|
||||
public class OBjcUtils: NSObject {
|
||||
@objc
|
||||
public static func setTestStatus(socket: SocketIOClient, status: SocketIOStatus) {
|
||||
socket.setTestStatus(status)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
# Upgrading from v12
|
||||
|
||||
This guide will help you navigate the changes that were introduced in v13.
|
||||
|
||||
## What are the big changes?
|
||||
|
||||
The biggest change is how to create and manage clients. Much like the native JS client and server,
|
||||
the swift client now only uses one engine per connection. Previously in order to use namespaces it was required
|
||||
to create multiple clients, and each client had its own engine.
|
||||
|
||||
Some v12 code might've looked like this:
|
||||
|
||||
```swift
|
||||
let defaultSocket = SocketIOClient(socketURL: myURL)
|
||||
let namespaceSocket = SocketIOClient(socketURL: myURL, config: [.nsp("/swift")])
|
||||
|
||||
// add handlers for sockets and connect
|
||||
|
||||
```
|
||||
|
||||
In v12 this would have opened two connections to the socket.io.
|
||||
|
||||
|
||||
In v13 the same code would look like this:
|
||||
|
||||
```swift
|
||||
let manager = SocketManager(socketURL: myURL)
|
||||
let defaultSocket = manager.defaultSocket
|
||||
let namespaceSocket = manager.socket(forNamespace: "/swift")
|
||||
|
||||
// add handlers for sockets and connect
|
||||
```
|
||||
|
||||
In v13 `defaultSocket` and `namespaceSocket` will share a single transport. This means one less connection to the server
|
||||
needs to be opened.
|
||||
|
||||
## What might I have to change?
|
||||
|
||||
- The most obvious thing you will need to change is that instead of creating `SocketIOClient`s directly, you will create a
|
||||
`SocketManager` and either use the `defaultSocket` property if you don't need namespaces, or call the
|
||||
`socket(forNamespace:)` method on the manager.
|
||||
|
||||
- `SocketIOClient` is no longer a client to an engine. So if you were overriding the engine methods, these have been moved
|
||||
to the manager.
|
||||
|
||||
- The library is now a single target. So you might have to change some of your Xcode project settings.
|
||||
|
||||
- `SocketIOClient`s no longer take a configuration, they are shared from the manager.
|
||||
|
||||
- The `joinNamespace()` and `leaveNamespace()` methods on `SocketIOClient` no longer take any arguments, and in most cases
|
||||
no longer need to be called. Namespace joining/leaving can be managed by calling `connect()`/`disconnect()` on the socket
|
||||
associated with that namespace.
|
||||
|
||||
----------
|
||||
|
||||
# What things should I know?
|
||||
|
||||
How sockets are stored
|
||||
---
|
||||
|
||||
You should know that `SocketIOClient`s no longer need to be held around in properties, but the `SocketManager` should.
|
||||
|
||||
One of the most common mistakes people made is not maintaining a strong reference to the client.
|
||||
|
||||
```swift
|
||||
class Manager {
|
||||
func addHandlers() {
|
||||
let socket = SocketIOClient(socketURL: myURL, config: [.nsp("/swift")])
|
||||
|
||||
// Add handlers
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This would have resulted in the client being released and no handlers being called.
|
||||
|
||||
A *correct* equivalent would be:
|
||||
|
||||
```swift
|
||||
class Manager {
|
||||
let socketManager = SocketManager(socketURL: someURL)
|
||||
|
||||
func addHandlers() {
|
||||
let socket = socketManager.socket(forNamespace: "/swift")
|
||||
|
||||
// Add handlers
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This code is fine because the `SocketManager` will maintain a strong reference to the socket.
|
||||
|
||||
It's also worth noting that subsequent calls to `socket(forNamespace:)` will return the *same* socket instance as the
|
||||
first call. So you don't need to hold onto the socket directly just to access it again, just call `socket(forNamespace:)`
|
||||
on the manager to get it. **This does mean that if you need multiple sockets on the same namespace, you will have to use
|
||||
multiple managers.**
|
||||
|
||||
What to call connect on
|
||||
---
|
||||
|
||||
Connect can either be called on the manager directly, or on one of the sockets made from it. In either case, if the manager
|
||||
was not already connected to the server, a connection will be made. Also in both cases the default socket (namespace "/")
|
||||
will fire a `connect` event.
|
||||
|
||||
The difference is that if `connect()` is just called on the manager, then any sockets for that manager that are not the default
|
||||
socket will not automatically connect. `connect()` will need to be called individually for each socket. However, if `connect()`
|
||||
is called on a client, then in addition to opening the connection if needed, the client will connect to its namespace,
|
||||
and a `connect` event fired.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Upgrading from v15 to v16
|
||||
|
||||
This guide will help you navigate the changes that were introduced in v16.
|
||||
|
||||
## Objective-c is no longer supported. You must now use Swift.
|
||||
|
||||
## Client supports multiple socket.io versions
|
||||
|
||||
The client now supports socket.io 3 servers. This is mostly a transparent change, however if your server
|
||||
is socket.io 2, you must send `.version(.two)` as an option to the manager.
|
||||
|
||||
```swift
|
||||
SocketManager(socketURL: URL(string:"http://localhost:8087/")!, config: [.version(.two)])
|
||||
```
|
||||
|
||||
## How to upgrade
|
||||
|
||||
- first, upgrade the Socket.IO server to v4 with the compatibility mode enabled (`allowEIO3: true`)
|
||||
- then, upgrade the clients to v16
|
||||
- finally, once all clients have upgraded, disable the compatibility mode
|
||||
|
||||
You can check the version of the connection on the server side with:
|
||||
|
||||
```js
|
||||
io.on("connection", (socket) => {
|
||||
// either 3 for the 3rd revision of the protocol (Socket.IO v2) or 4 for the 4th revision (Socket.IO v3/v4)
|
||||
const version = socket.conn.protocol;
|
||||
});
|
||||
```
|
||||
|
||||
See also:
|
||||
|
||||
- [Compatibility table](https://nuclearace.github.io/Socket.IO-Client-Swift/Compatibility.html)
|
||||
- Migrating from 2.x to 3.0: https://socket.io/docs/v4/migrating-from-2-x-to-3-0/
|
||||
- Migrating from 3.x to 4.0: https://socket.io/docs/v4/migrating-from-3-x-to-4-0/
|
||||
@@ -0,0 +1,61 @@
|
||||
Here is the compatibility table with the Node.js server:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th rowspan="2">Swift Client version</th>
|
||||
<th colspan="3">Socket.IO server version</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">2.x</td>
|
||||
<td align="center">3.x</td>
|
||||
<td align="center">4.x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">v15.x</td>
|
||||
<td align="center"><b>YES</b></td>
|
||||
<td align="center"><b>YES</b><sup>1</sup></td>
|
||||
<td align="center"><b>YES</b><sup>2</sup></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">v16.x</td>
|
||||
<td align="center"><b>YES</b><sup>3</sup></td>
|
||||
<td align="center"><b>YES</b></td>
|
||||
<td align="center"><b>YES</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
[1] Yes, with <code><a href="https://socket.io/docs/v4/server-initialization/#allowEIO3">allowEIO3: true</a></code> (server) and `.connectParams(["EIO": "3"])` (client):
|
||||
|
||||
*Server*
|
||||
|
||||
```js
|
||||
const { createServer } = require("http");
|
||||
const { Server } = require("socket.io");
|
||||
|
||||
const httpServer = createServer();
|
||||
const io = new Server(httpServer, {
|
||||
allowEIO3: true
|
||||
});
|
||||
|
||||
httpServer.listen(8080);
|
||||
```
|
||||
|
||||
*Client*
|
||||
|
||||
```swift
|
||||
SocketManager(socketURL: URL(string:"http://localhost:8080/")!, config: [.connectParams(["EIO": "3"])])
|
||||
```
|
||||
|
||||
[2] Yes, <code><a href="https://socket.io/docs/v4/server-initialization/#allowEIO3">allowEIO3: true</a></code> (server)
|
||||
|
||||
[3] Yes, with `.version(.two)` (client):
|
||||
|
||||
```swift
|
||||
SocketManager(socketURL: URL(string:"http://localhost:8080/")!, config: [.version(.two)])
|
||||
```
|
||||
|
||||
See also:
|
||||
|
||||
- Migrating from 2.x to 3.0: https://socket.io/docs/v4/migrating-from-2-x-to-3-0/
|
||||
- Migrating from 3.x to 4.0: https://socket.io/docs/v4/migrating-from-3-x-to-4-0/
|
||||
- Socket.IO protocol: https://github.com/socketio/socket.io-protocol
|
||||
@@ -0,0 +1,44 @@
|
||||
## How do I connect to my WebSocket server?
|
||||
|
||||
This library is **NOT** a WebSockets library. This library is only for servers that implement the socket.io protocol,
|
||||
such as [socket.io](https://socket.io/). If you need a plain WebSockets client check out
|
||||
[Starscream](https://github.com/daltoniam/Starscream) for Swift and [JetFire](https://github.com/acmacalister/jetfire)
|
||||
for Objective-C.
|
||||
|
||||
## Why isn't my event handler being called?
|
||||
|
||||
One of the most common reasons your event might not be called is if the client is released by
|
||||
[ARC](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/AutomaticReferenceCounting.html).
|
||||
|
||||
Take this code for example:
|
||||
|
||||
```swift
|
||||
class Manager {
|
||||
func addHandlers() {
|
||||
let manager = SocketManager(socketURL: URL(string: "http://somesocketioserver.com")!)
|
||||
|
||||
manager.defaultSocket.on("myEvent") {data, ack in
|
||||
print(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
This code is **incorrect**, and the event handler will never be called. Because as soon as this method is called `manager`
|
||||
will be released, along with the socket, and its memory reclaimed.
|
||||
|
||||
A correct way would be:
|
||||
|
||||
```swift
|
||||
class Manager {
|
||||
let manager = SocketManager(socketURL: URL(string: "http://somesocketioserver.com")!)
|
||||
|
||||
func addHandlers() {
|
||||
manager.defaultSocket.on("myEvent") {data, ack in
|
||||
print(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
@@ -0,0 +1,335 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>12to13 Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<a title="12to13 Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
12to13 Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
|
||||
<h1 id='upgrading-from-v12' class='heading'>Upgrading from v12</h1>
|
||||
|
||||
<p>This guide will help you navigate the changes that were introduced in v13.</p>
|
||||
<h2 id='what-are-the-big-changes' class='heading'>What are the big changes?</h2>
|
||||
|
||||
<p>The biggest change is how to create and manage clients. Much like the native JS client and server,
|
||||
the swift client now only uses one engine per connection. Previously in order to use namespaces it was required
|
||||
to create multiple clients, and each client had its own engine.</p>
|
||||
|
||||
<p>Some v12 code might’ve looked like this:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">defaultSocket</span> <span class="o">=</span> <span class="kt">SocketIOClient</span><span class="p">(</span><span class="nv">socketURL</span><span class="p">:</span> <span class="n">myURL</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">namespaceSocket</span> <span class="o">=</span> <span class="kt">SocketIOClient</span><span class="p">(</span><span class="nv">socketURL</span><span class="p">:</span> <span class="n">myURL</span><span class="p">,</span> <span class="nv">config</span><span class="p">:</span> <span class="p">[</span><span class="o">.</span><span class="nf">nsp</span><span class="p">(</span><span class="s">"/swift"</span><span class="p">)])</span>
|
||||
|
||||
<span class="c1">// add handlers for sockets and connect</span>
|
||||
|
||||
</code></pre>
|
||||
|
||||
<p>In v12 this would have opened two connections to the socket.io.</p>
|
||||
|
||||
<p>In v13 the same code would look like this:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">manager</span> <span class="o">=</span> <span class="kt">SocketManager</span><span class="p">(</span><span class="nv">socketURL</span><span class="p">:</span> <span class="n">myURL</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">defaultSocket</span> <span class="o">=</span> <span class="n">manager</span><span class="o">.</span><span class="n">defaultSocket</span>
|
||||
<span class="k">let</span> <span class="nv">namespaceSocket</span> <span class="o">=</span> <span class="n">manager</span><span class="o">.</span><span class="nf">socket</span><span class="p">(</span><span class="nv">forNamespace</span><span class="p">:</span> <span class="s">"/swift"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1">// add handlers for sockets and connect</span>
|
||||
</code></pre>
|
||||
|
||||
<p>In v13 <code>defaultSocket</code> and <code>namespaceSocket</code> will share a single transport. This means one less connection to the server
|
||||
needs to be opened. </p>
|
||||
<h2 id='what-might-i-have-to-change' class='heading'>What might I have to change?</h2>
|
||||
|
||||
<ul>
|
||||
<li><p>The most obvious thing you will need to change is that instead of creating <code><a href="Classes/SocketIOClient.html">SocketIOClient</a></code>s directly, you will create a
|
||||
<code><a href="Classes/SocketManager.html">SocketManager</a></code> and either use the <code>defaultSocket</code> property if you don’t need namespaces, or call the
|
||||
<code>socket(forNamespace:)</code> method on the manager.</p></li>
|
||||
<li><p><code><a href="Classes/SocketIOClient.html">SocketIOClient</a></code> is no longer a client to an engine. So if you were overriding the engine methods, these have been moved
|
||||
to the manager. </p></li>
|
||||
<li><p>The library is now a single target. So you might have to change some of your Xcode project settings.</p></li>
|
||||
<li><p><code><a href="Classes/SocketIOClient.html">SocketIOClient</a></code>s no longer take a configuration, they are shared from the manager.</p></li>
|
||||
<li><p>The <code>joinNamespace()</code> and <code>leaveNamespace()</code> methods on <code><a href="Classes/SocketIOClient.html">SocketIOClient</a></code> no longer take any arguments, and in most cases
|
||||
no longer need to be called. Namespace joining/leaving can be managed by calling <code>connect()</code>/<code>disconnect()</code> on the socket
|
||||
associated with that namespace.</p></li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<h1 id='what-things-should-i-know' class='heading'>What things should I know?</h1>
|
||||
<h2 id='how-sockets-are-stored' class='heading'>How sockets are stored</h2>
|
||||
|
||||
<p>You should know that <code><a href="Classes/SocketIOClient.html">SocketIOClient</a></code>s no longer need to be held around in properties, but the <code><a href="Classes/SocketManager.html">SocketManager</a></code> should.</p>
|
||||
|
||||
<p>One of the most common mistakes people made is not maintaining a strong reference to the client.</p>
|
||||
<pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">Manager</span> <span class="p">{</span>
|
||||
<span class="kd">func</span> <span class="nf">addHandlers</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="k">let</span> <span class="nv">socket</span> <span class="o">=</span> <span class="kt">SocketIOClient</span><span class="p">(</span><span class="nv">socketURL</span><span class="p">:</span> <span class="n">myURL</span><span class="p">,</span> <span class="nv">config</span><span class="p">:</span> <span class="p">[</span><span class="o">.</span><span class="nf">nsp</span><span class="p">(</span><span class="s">"/swift"</span><span class="p">)])</span>
|
||||
|
||||
<span class="c1">// Add handlers</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>This would have resulted in the client being released and no handlers being called.</p>
|
||||
|
||||
<p>A <em>correct</em> equivalent would be:</p>
|
||||
<pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">Manager</span> <span class="p">{</span>
|
||||
<span class="k">let</span> <span class="nv">socketManager</span> <span class="o">=</span> <span class="kt">SocketManager</span><span class="p">(</span><span class="nv">socketURL</span><span class="p">:</span> <span class="n">someURL</span><span class="p">)</span>
|
||||
|
||||
<span class="kd">func</span> <span class="nf">addHandlers</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="k">let</span> <span class="nv">socket</span> <span class="o">=</span> <span class="n">socketManager</span><span class="o">.</span><span class="nf">socket</span><span class="p">(</span><span class="nv">forNamespace</span><span class="p">:</span> <span class="s">"/swift"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1">// Add handlers</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>This code is fine because the <code><a href="Classes/SocketManager.html">SocketManager</a></code> will maintain a strong reference to the socket.</p>
|
||||
|
||||
<p>It’s also worth noting that subsequent calls to <code>socket(forNamespace:)</code> will return the <em>same</em> socket instance as the
|
||||
first call. So you don’t need to hold onto the socket directly just to access it again, just call <code>socket(forNamespace:)</code>
|
||||
on the manager to get it. <strong>This does mean that if you need multiple sockets on the same namespace, you will have to use
|
||||
multiple managers.</strong></p>
|
||||
<h2 id='what-to-call-connect-on' class='heading'>What to call connect on</h2>
|
||||
|
||||
<p>Connect can either be called on the manager directly, or on one of the sockets made from it. In either case, if the manager
|
||||
was not already connected to the server, a connection will be made. Also in both cases the default socket (namespace “/”)
|
||||
will fire a <code>connect</code> event. </p>
|
||||
|
||||
<p>The difference is that if <code>connect()</code> is just called on the manager, then any sockets for that manager that are not the default
|
||||
socket will not automatically connect. <code>connect()</code> will need to be called individually for each socket. However, if <code>connect()</code>
|
||||
is called on a client, then in addition to opening the connection if needed, the client will connect to its namespace,
|
||||
and a <code>connect</code> event fired.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -0,0 +1,255 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>15to16 Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<a title="15to16 Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
15to16 Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
|
||||
<h1 id='upgrading-from-v15-to-v16' class='heading'>Upgrading from v15 to v16</h1>
|
||||
|
||||
<p>This guide will help you navigate the changes that were introduced in v16.</p>
|
||||
<h2 id='objective-c-is-no-longer-supported-you-must-now-use-swift' class='heading'>Objective-c is no longer supported. You must now use Swift.</h2>
|
||||
<h2 id='client-supports-multiple-socket-io-versions' class='heading'>Client supports multiple socket.io versions</h2>
|
||||
|
||||
<p>The client now supports socket.io 3 servers. This is mostly a transparent change, however if your sever
|
||||
is socket.io 2, you must send <code>.version(.two)</code> as an option to the manager.</p>
|
||||
<pre class="highlight swift"><code><span class="kt">SocketManager</span><span class="p">(</span><span class="nv">socketURL</span><span class="p">:</span> <span class="kt">URL</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span><span class="s">"http://localhost:8087/"</span><span class="p">)</span><span class="o">!</span><span class="p">,</span> <span class="nv">config</span><span class="p">:</span> <span class="p">[</span><span class="o">.</span><span class="nf">version</span><span class="p">(</span><span class="o">.</span><span class="n">two</span><span class="p">)])</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
+261
-208
@@ -14,15 +14,16 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Classes" class="dashAnchor"></a>
|
||||
|
||||
<a title="Classes Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -43,27 +44,32 @@
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -71,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -108,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -116,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -133,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -168,7 +228,7 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Classes</h1>
|
||||
<p>The following classes are available globally.</p>
|
||||
|
||||
@@ -182,42 +242,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:C8SocketIO12SocketEngine"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketEngine" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:C8SocketIO12SocketEngine">SocketEngine</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The class that handles the engine.io protocol and transports.
|
||||
See <code><a href="Protocols/SocketEnginePollable.html">SocketEnginePollable</a></code> and <code><a href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a></code> for transport specific methods.</p>
|
||||
|
||||
<a href="Classes/SocketEngine.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketEngine</span> <span class="p">:</span> <span class="kt">NSObject</span><span class="p">,</span> <span class="kt">URLSessionDelegate</span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketEnginePollable.html">SocketEnginePollable</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:C8SocketIO16SocketAckEmitter"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketAckEmitter"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketAckEmitter" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:C8SocketIO16SocketAckEmitter">SocketAckEmitter</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketAckEmitter">SocketAckEmitter</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -235,7 +262,7 @@ See <code><a href="Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketAckEmitter</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketAckEmitter</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -245,9 +272,9 @@ See <code><a href="Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:C8SocketIO13OnAckCallback"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)OnAckCallback"></a>
|
||||
<a name="//apple_ref/swift/Class/OnAckCallback" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:C8SocketIO13OnAckCallback">OnAckCallback</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)OnAckCallback">OnAckCallback</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -269,125 +296,19 @@ Example:</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">OnAckCallback</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">OnAckCallback</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:C8SocketIO14SocketIOClient"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketIOClient" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:C8SocketIO14SocketIOClient">SocketIOClient</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The main class for SocketIOClientSwift.</p>
|
||||
|
||||
<p>Represents a socket.io-client. Most interaction with socket.io will be through this class.</p>
|
||||
|
||||
<a href="Classes/SocketIOClient.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">class</span> <span class="kt">SocketIOClient</span> <span class="p">:</span> <span class="kt">NSObject</span><span class="p">,</span> <span class="kt">SocketIOClientSpec</span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketEngineClient.html">SocketEngineClient</a></span><span class="p">,</span> <span class="kt">SocketParsable</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:C8SocketIO9WebSocket"></a>
|
||||
<a name="//apple_ref/swift/Class/WebSocket" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:C8SocketIO9WebSocket">WebSocket</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
<a href="Classes/WebSocket.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:C8SocketIO7SSLCert"></a>
|
||||
<a name="//apple_ref/swift/Class/SSLCert" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:C8SocketIO7SSLCert">SSLCert</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
<a href="Classes/SSLCert.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:C8SocketIO11SSLSecurity"></a>
|
||||
<a name="//apple_ref/swift/Class/SSLSecurity" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:C8SocketIO11SSLSecurity">SSLSecurity</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
<a href="Classes/SSLSecurity.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:C8SocketIO14SocketAnyEvent"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketAnyEvent"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketAnyEvent" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:C8SocketIO14SocketAnyEvent">SocketAnyEvent</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketAnyEvent">SocketAnyEvent</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -403,23 +324,19 @@ Example:</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketAnyEvent</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketAnyEvent</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:C8SocketIO19SocketClientManager"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketClientManager" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:C8SocketIO19SocketClientManager">SocketClientManager</a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketIOClient"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketIOClient" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketIOClient">SocketIOClient</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -427,30 +344,166 @@ Example:</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Experimental socket manager.</p>
|
||||
<p>Represents a socket.io-client.</p>
|
||||
|
||||
<p>API subject to change.</p>
|
||||
<p>Clients are created through a <code><a href="Classes/SocketManager.html">SocketManager</a></code>, which owns the <code><a href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a></code> that controls the connection to the server.</p>
|
||||
|
||||
<p>Can be used to persist sockets across ViewControllers.</p>
|
||||
<p>For example:</p>
|
||||
<pre class="highlight swift"><code><span class="c1">// Create a socket for the /swift namespace</span>
|
||||
<span class="k">let</span> <span class="nv">socket</span> <span class="o">=</span> <span class="n">manager</span><span class="o">.</span><span class="nf">socket</span><span class="p">(</span><span class="nv">forNamespace</span><span class="p">:</span> <span class="s">"/swift"</span><span class="p">)</span>
|
||||
|
||||
<p>Sockets are strongly stored, so be sure to remove them once they are no
|
||||
longer needed.</p>
|
||||
|
||||
<p>Example usage:</p>
|
||||
<pre class="highlight plaintext"><code>let manager = SocketClientManager.sharedManager
|
||||
manager["room1"] = socket1
|
||||
manager["room2"] = socket2
|
||||
manager.removeSocket(socket: socket2)
|
||||
manager["room1"]?.emit("hello")
|
||||
<span class="c1">// Add some handlers and connect</span>
|
||||
</code></pre>
|
||||
|
||||
<a href="Classes/SocketClientManager.html" class="slightly-smaller">See more</a>
|
||||
<p><strong>NOTE</strong>: The client is not thread/queue safe, all interaction with the socket should be done on the <code>manager.handleQueue</code></p>
|
||||
|
||||
<a href="Classes/SocketIOClient.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">class</span> <span class="kt">SocketClientManager</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kt">SocketIOClient</span> <span class="p">:</span> <span class="kt">NSObject</span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketRawView"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketRawView" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketRawView">SocketRawView</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="n">rawEmitView</span><span class="o">.</span><span class="nf">emit</span><span class="p">(</span><span class="s">"myEvent"</span><span class="p">,</span> <span class="n">myObject</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
<a href="Classes/SocketRawView.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketRawView</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketRawAckView"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketRawAckView" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketRawAckView">SocketRawAckView</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">ack</span><span class="o">.</span><span class="n">rawEmitView</span><span class="o">.</span><span class="nf">with</span><span class="p">(</span><span class="n">myObject</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
<a href="Classes/SocketRawAckView.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketRawAckView</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketEngine"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketEngine" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketEngine">SocketEngine</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The class that handles the engine.io protocol and transports.
|
||||
See <code><a href="Protocols/SocketEnginePollable.html">SocketEnginePollable</a></code> and <code><a href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a></code> for transport specific methods.</p>
|
||||
|
||||
<a href="Classes/SocketEngine.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kt">SocketEngine</span><span class="p">:</span>
|
||||
<span class="kt">NSObject</span><span class="p">,</span> <span class="kt">WebSocketDelegate</span><span class="p">,</span> <span class="kt">URLSessionDelegate</span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketEnginePollable.html">SocketEnginePollable</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/ConfigSettable.html">ConfigSettable</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketManager"></a>
|
||||
<a name="//apple_ref/swift/Class/SocketManager" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketManager">SocketManager</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A manager for a socket.io connection.</p>
|
||||
|
||||
<p>A <code>SocketManager</code> is responsible for multiplexing multiple namespaces through a single <code><a href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a></code>.</p>
|
||||
|
||||
<p>Example:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">manager</span> <span class="o">=</span> <span class="kt">SocketManager</span><span class="p">(</span><span class="nv">socketURL</span><span class="p">:</span> <span class="kt">URL</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span><span class="s">"http://localhost:8080/"</span><span class="p">)</span><span class="o">!</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">defaultNamespaceSocket</span> <span class="o">=</span> <span class="n">manager</span><span class="o">.</span><span class="n">defaultSocket</span>
|
||||
<span class="k">let</span> <span class="nv">swiftSocket</span> <span class="o">=</span> <span class="n">manager</span><span class="o">.</span><span class="nf">socket</span><span class="p">(</span><span class="nv">forNamespace</span><span class="p">:</span> <span class="s">"/swift"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1">// defaultNamespaceSocket and swiftSocket both share a single connection to the server</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Sockets created through the manager are retained by the manager. So at the very least, a single strong reference
|
||||
to the manager must be maintained to keep sockets alive.</p>
|
||||
|
||||
<p>To disconnect a socket and remove it from the manager, either call <code><a href="Classes/SocketIOClient.html#/s:8SocketIO0A8IOClientC10disconnectyyF">SocketIOClient.disconnect()</a></code> on the socket,
|
||||
or call one of the <code>disconnectSocket</code> methods on this class.</p>
|
||||
|
||||
<p><strong>NOTE</strong>: The manager is not thread/queue safe, all interaction with the manager should be done on the <code>handleQueue</code></p>
|
||||
|
||||
<a href="Classes/SocketManager.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kt">SocketManager</span> <span class="p">:</span> <span class="kt">NSObject</span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketManagerSpec.html">SocketManagerSpec</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketParsable.html">SocketParsable</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketDataBufferable.html">SocketDataBufferable</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/ConfigSettable.html">ConfigSettable</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -465,8 +518,8 @@ manager["room1"]?.emit("hello")
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
+111
-48
@@ -21,9 +21,9 @@
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -44,27 +44,32 @@
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,11 +228,12 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>OnAckCallback</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">OnAckCallback</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">OnAckCallback</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -194,17 +254,19 @@ Example:</p>
|
||||
<div class="task-name-container">
|
||||
<a name="/Methods"></a>
|
||||
<a name="//apple_ref/swift/Section/Methods" class="dashAnchor"></a>
|
||||
<a href="#/Methods">
|
||||
<h3 class="section-name">Methods</h3>
|
||||
</a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Methods"></a>
|
||||
<h3 class="section-name"><p>Methods</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO13OnAckCallback9timingOutFT5afterSi8callbackFGSaP__T__T_"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)OnAckCallback(im)timingOutAfter:callback:"></a>
|
||||
<a name="//apple_ref/swift/Method/timingOut(after:callback:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO13OnAckCallback9timingOutFT5afterSi8callbackFGSaP__T__T_">timingOut(after:callback:)</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)OnAckCallback(im)timingOutAfter:callback:">timingOut(after:<wbr>callback:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -219,7 +281,8 @@ Example:</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">timingOut</span><span class="p">(</span><span class="n">after</span> <span class="nv">seconds</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="nv">callback</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="kt"><a href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a></span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">timingOut</span><span class="p">(</span><span class="n">after</span> <span class="nv">seconds</span><span class="p">:</span> <span class="kt">Double</span><span class="p">,</span> <span class="nv">callback</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="kt"><a href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -230,7 +293,7 @@ Example:</p>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>after</em>
|
||||
<em>seconds</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
@@ -248,7 +311,7 @@ Example:</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>The callback called when an ack is received, or when a timeout happens.
|
||||
To check for timeout, use <code>SocketAckStatus</code>‘s <code>noAck</code> case.</p>
|
||||
To check for timeout, use <code><a href="../Enums/SocketAckStatus.html">SocketAckStatus</a></code>‘s <code>noAck</code> case.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -266,8 +329,8 @@ Example:</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
+122
-75
@@ -23,7 +23,7 @@
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -44,15 +44,23 @@
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
@@ -62,9 +70,6 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,10 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +114,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +134,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -171,7 +186,13 @@
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>SSLSecurity</h1>
|
||||
<p>Undocumented</p>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kt">SSLSecurity</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>A wrapper around Starscream’s SSLSecurity that provides a minimal Objective-C interface.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -179,13 +200,20 @@
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Properties"></a>
|
||||
<a name="//apple_ref/swift/Section/Properties" class="dashAnchor"></a>
|
||||
<a href="#/Properties">
|
||||
<h3 class="section-name">Properties</h3>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO11SSLSecurity11validatedDNSb"></a>
|
||||
<a name="//apple_ref/swift/Property/validatedDN" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO11SSLSecurity11validatedDNSb">validatedDN</a>
|
||||
<a name="/s:8SocketIO11SSLSecurityC8security10StarscreamABCvp"></a>
|
||||
<a name="//apple_ref/swift/Property/security" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO11SSLSecurityC8security10StarscreamABCvp">security</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -193,33 +221,54 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO11SSLSecuritycFT13usePublicKeysSb_S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(usePublicKeys:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO11SSLSecuritycFT13usePublicKeysSb_S0_">init(usePublicKeys:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Use certs from main app bundle</p>
|
||||
<p>The internal Starscream SSLSecurity.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="n">convenience</span> <span class="nf">init</span><span class="p">(</span><span class="nv">usePublicKeys</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">security</span><span class="p">:</span> <span class="kt">Starscream</span><span class="o">.</span><span class="kt">SSLSecurity</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Methods"></a>
|
||||
<a name="//apple_ref/swift/Section/Methods" class="dashAnchor"></a>
|
||||
<a href="#/Methods">
|
||||
<h3 class="section-name">Methods</h3>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SSLSecurity(im)initWithUsePublicKeys:"></a>
|
||||
<a name="//apple_ref/swift/Method/init(usePublicKeys:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SSLSecurity(im)initWithUsePublicKeys:">init(usePublicKeys:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Creates a new SSLSecurity that specifies whether to use publicKeys or certificates should be used for SSL
|
||||
pinning validation</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="n">convenience</span> <span class="nf">init</span><span class="p">(</span><span class="nv">usePublicKeys</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -235,26 +284,23 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>is to specific if the publicKeys or certificates should be used for SSL pinning validation</p>
|
||||
<p>is to specific if the publicKeys or certificates should be used for SSL pinning
|
||||
validation</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>a representation security object to be used with</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO11SSLSecuritycFT5certsGSaCS_7SSLCert_13usePublicKeysSb_S0_"></a>
|
||||
<a name="/s:8SocketIO11SSLSecurityC5certs13usePublicKeysACSay10Starscream7SSLCertCG_Sbtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(certs:usePublicKeys:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO11SSLSecuritycFT5certsGSaCS_7SSLCert_13usePublicKeysSb_S0_">init(certs:usePublicKeys:)</a>
|
||||
<a class="token" href="#/s:8SocketIO11SSLSecurityC5certs13usePublicKeysACSay10Starscream7SSLCertCG_Sbtcfc">init(certs:usePublicKeys:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -269,7 +315,7 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">certs</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Classes/SSLCert.html">SSLCert</a></span><span class="p">],</span> <span class="nv">usePublicKeys</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="n">convenience</span> <span class="nf">init</span><span class="p">(</span><span class="nv">certs</span><span class="p">:</span> <span class="p">[</span><span class="kt">SSLCert</span><span class="p">],</span> <span class="nv">usePublicKeys</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -297,7 +343,8 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>is to specific if the publicKeys or certificates should be used for SSL pinning validation</p>
|
||||
<p>is to specific if the publicKeys or certificates should be used for SSL pinning
|
||||
validation</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -314,9 +361,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO11SSLSecurity7isValidFTCSo8SecTrust6domainGSqSS__Sb"></a>
|
||||
<a name="/s:8SocketIO11SSLSecurityC7isValid_6domainSbSo11SecTrustRefa_SSSgtF"></a>
|
||||
<a name="//apple_ref/swift/Method/isValid(_:domain:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO11SSLSecurity7isValidFTCSo8SecTrust6domainGSqSS__Sb">isValid(_:domain:)</a>
|
||||
<a class="token" href="#/s:8SocketIO11SSLSecurityC7isValid_6domainSbSo11SecTrustRefa_SSSgtF">isValid(_:domain:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -324,14 +371,14 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Valid the trust and domain name.</p>
|
||||
<p>Returns whether or not the given trust is valid.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">isValid</span><span class="p">(</span><span class="n">_</span> <span class="nv">trust</span><span class="p">:</span> <span class="kt">SecTrust</span><span class="p">,</span> <span class="nv">domain</span><span class="p">:</span> <span class="kt">String</span><span class="p">?)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">isValid</span><span class="p">(</span><span class="n">_</span> <span class="nv">trust</span><span class="p">:</span> <span class="kt">SecTrust</span><span class="p">,</span> <span class="nv">domain</span><span class="p">:</span> <span class="kt">String</span><span class="p">?)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -347,7 +394,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>is the serverTrust to validate</p>
|
||||
<p>The trust to validate.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -359,7 +406,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>is the CN domain to validate</p>
|
||||
<p>The CN domain to validate.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -368,7 +415,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>if the key was successfully validated</p>
|
||||
<p>Whether or not this is valid.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
@@ -381,8 +428,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2019 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2019-05-28)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -44,27 +44,32 @@
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,11 +228,12 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketAckEmitter</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketAckEmitter</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketAckEmitter</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -186,21 +246,61 @@
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketAckEmitter(py)rawEmitView"></a>
|
||||
<a name="//apple_ref/swift/Property/rawEmitView" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketAckEmitter(py)rawEmitView">rawEmitView</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A view into this emitter where emits do not check for binary data.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">ack</span><span class="o">.</span><span class="n">rawEmitView</span><span class="o">.</span><span class="nf">with</span><span class="p">(</span><span class="n">myObject</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
<p><strong>NOTE</strong>: It is not safe to hold on to this view beyond the life of the socket.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">private(set)</span> <span class="kd">lazy</span> <span class="k">var</span> <span class="nv">rawEmitView</span><span class="p">:</span> <span class="kt"><a href="../Classes/SocketRawAckView.html">SocketRawAckView</a></span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Properties"></a>
|
||||
<a name="//apple_ref/swift/Section/Properties" class="dashAnchor"></a>
|
||||
<a href="#/Properties">
|
||||
<h3 class="section-name">Properties</h3>
|
||||
</a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Properties"></a>
|
||||
<h3 class="section-name"><p>Properties</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO16SocketAckEmitter8expectedSb"></a>
|
||||
<a name="/s:8SocketIO0A10AckEmitterC8expectedSbvp"></a>
|
||||
<a name="//apple_ref/swift/Property/expected" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO16SocketAckEmitter8expectedSb">expected</a>
|
||||
<a class="token" href="#/s:8SocketIO0A10AckEmitterC8expectedSbvp">expected</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -215,7 +315,7 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">expected</span><span class="p">:</span> <span class="kt">Bool</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">expected</span><span class="p">:</span> <span class="kt">Bool</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -226,19 +326,92 @@
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Methods"></a>
|
||||
<a name="//apple_ref/swift/Section/Methods" class="dashAnchor"></a>
|
||||
<a href="#/Methods">
|
||||
<h3 class="section-name">Methods</h3>
|
||||
</a>
|
||||
<a name="/Initializers"></a>
|
||||
<a name="//apple_ref/swift/Section/Initializers" class="dashAnchor"></a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Initializers"></a>
|
||||
<h3 class="section-name"><p>Initializers</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO16SocketAckEmitter4withFtGSaPS_10SocketData___T_"></a>
|
||||
<a name="/s:8SocketIO0A10AckEmitterC6socket6ackNumAcA0A8IOClientC_Sitcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(socket:ackNum:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A10AckEmitterC6socket6ackNumAcA0A8IOClientC_Sitcfc">init(socket:<wbr>ackNum:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Creates a new <code>SocketAckEmitter</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">socket</span><span class="p">:</span> <span class="kt"><a href="../Classes/SocketIOClient.html">SocketIOClient</a></span><span class="p">,</span> <span class="nv">ackNum</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>socket</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The socket for this emitter.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>ackNum</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The ack number for this emitter.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Methods"></a>
|
||||
<a name="//apple_ref/swift/Section/Methods" class="dashAnchor"></a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Methods"></a>
|
||||
<h3 class="section-name"><p>Methods</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A10AckEmitterC4withyyAA0A4Data_pd_tF"></a>
|
||||
<a name="//apple_ref/swift/Method/with(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO16SocketAckEmitter4withFtGSaPS_10SocketData___T_">with(_:)</a>
|
||||
<a class="token" href="#/s:8SocketIO0A10AckEmitterC4withyyAA0A4Data_pd_tF">with(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -248,7 +421,7 @@
|
||||
<div class="abstract">
|
||||
<p>Call to ack receiving this event.</p>
|
||||
|
||||
<p>If an error occurs trying to transform <code>items</code> into their socket representation, a <code><a href="../Enums/SocketClientEvent.html#/s:FO8SocketIO17SocketClientEvent5errorFMS0_S0_">SocketClientEvent.error</a></code>
|
||||
<p>If an error occurs trying to transform <code>items</code> into their socket representation, a <code><a href="../Enums/SocketClientEvent.html#/s:8SocketIO0A11ClientEventO5erroryA2CmF">SocketClientEvent.error</a></code>
|
||||
will be emitted. The structure of the error data is <code>[ackNum, items, theError]</code></p>
|
||||
|
||||
</div>
|
||||
@@ -256,7 +429,7 @@ will be emitted. The structure of the error data is <code>[ackNum, items, theErr
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">with</span><span class="p">(</span><span class="n">_</span> <span class="nv">items</span><span class="p">:</span> <span class="kt"><a href="../Protocols/SocketData.html">SocketData</a></span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">with</span><span class="p">(</span><span class="n">_</span> <span class="nv">items</span><span class="p">:</span> <span class="kt"><a href="../Protocols/SocketData.html">SocketData</a></span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -285,9 +458,9 @@ will be emitted. The structure of the error data is <code>[ackNum, items, theErr
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO16SocketAckEmitter4withFGSaP__T_"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketAckEmitter(im)with:"></a>
|
||||
<a name="//apple_ref/swift/Method/with(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO16SocketAckEmitter4withFGSaP__T_">with(_:)</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketAckEmitter(im)with:">with(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -302,7 +475,8 @@ will be emitted. The structure of the error data is <code>[ackNum, items, theErr
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">with</span><span class="p">(</span><span class="n">_</span> <span class="nv">items</span><span class="p">:</span> <span class="p">[</span><span class="kt">Any</span><span class="p">])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">with</span><span class="p">(</span><span class="n">_</span> <span class="nv">items</span><span class="p">:</span> <span class="p">[</span><span class="kt">Any</span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -336,8 +510,8 @@ will be emitted. The structure of the error data is <code>[ackNum, items, theErr
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -44,27 +44,32 @@
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,11 +228,12 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketAnyEvent</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketAnyEvent</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketAnyEvent</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -188,17 +248,19 @@
|
||||
<div class="task-name-container">
|
||||
<a name="/Properties"></a>
|
||||
<a name="//apple_ref/swift/Section/Properties" class="dashAnchor"></a>
|
||||
<a href="#/Properties">
|
||||
<h3 class="section-name">Properties</h3>
|
||||
</a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Properties"></a>
|
||||
<h3 class="section-name"><p>Properties</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO14SocketAnyEvent5eventSS"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketAnyEvent(py)event"></a>
|
||||
<a name="//apple_ref/swift/Property/event" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO14SocketAnyEvent5eventSS">event</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketAnyEvent(py)event">event</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -213,7 +275,8 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">event</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="k">let</span> <span class="nv">event</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -223,9 +286,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO14SocketAnyEvent5itemsGSqGSaP___"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketAnyEvent(py)items"></a>
|
||||
<a name="//apple_ref/swift/Property/items" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO14SocketAnyEvent5itemsGSqGSaP___">items</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketAnyEvent(py)items">items</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -240,7 +303,8 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">items</span><span class="p">:</span> <span class="p">[</span><span class="kt">Any</span><span class="p">]?</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="k">let</span> <span class="nv">items</span><span class="p">:</span> <span class="p">[</span><span class="kt">Any</span><span class="p">]?</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -250,9 +314,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO14SocketAnyEvent11descriptionSS"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketAnyEvent(py)description"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO14SocketAnyEvent11descriptionSS">description</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketAnyEvent(py)description">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -267,7 +331,7 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">override</span> <span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">override</span> <span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -282,8 +346,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -44,15 +44,20 @@
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
@@ -71,30 +76,10 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -111,14 +96,14 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
@@ -134,33 +119,42 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -211,9 +205,36 @@ manager["room1"]?.emit("hello")
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:iC8SocketIO19SocketClientManager9subscriptFSSGSqCS_14SocketIOClient_"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketClientManager(cpy)sharedManager"></a>
|
||||
<a name="//apple_ref/swift/Variable/sharedManager" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketClientManager(cpy)sharedManager">sharedManager</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The shared manager.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">static</span> <span class="k">let</span> <span class="nv">sharedManager</span> <span class="o">=</span> <span class="kt">SocketClientManager</span><span class="p">()</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A13ClientManagerC9subscriptAA0A8IOClientCSgSSci"></a>
|
||||
<a name="//apple_ref/swift/Method/subscript(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:iC8SocketIO19SocketClientManager9subscriptFSSGSqCS_14SocketIOClient_">subscript(_:)</a>
|
||||
<a class="token" href="#/s:8SocketIO0A13ClientManagerC9subscriptAA0A8IOClientCSgSSci">subscript(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -239,33 +260,6 @@ manager["room1"]?.emit("hello")
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:ZvC8SocketIO19SocketClientManager13sharedManagerS0_"></a>
|
||||
<a name="//apple_ref/swift/Variable/sharedManager" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:ZvC8SocketIO19SocketClientManager13sharedManagerS0_">sharedManager</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The shared manager.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">static</span> <span class="k">let</span> <span class="nv">sharedManager</span> <span class="o">=</span> <span class="kt">SocketClientManager</span><span class="p">()</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
@@ -280,9 +274,9 @@ manager["room1"]?.emit("hello")
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO19SocketClientManager9addSocketFTCS_14SocketIOClient9labeledAsSS_T_"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketClientManager(im)addSocket:labeledAs:"></a>
|
||||
<a name="//apple_ref/swift/Method/addSocket(_:labeledAs:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO19SocketClientManager9addSocketFTCS_14SocketIOClient9labeledAsSS_T_">addSocket(_:labeledAs:)</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketClientManager(im)addSocket:labeledAs:">addSocket(_:labeledAs:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -338,9 +332,9 @@ manager["room1"]?.emit("hello")
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO19SocketClientManager12removeSocketFT9withLabelSS_GSqCS_14SocketIOClient_"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketClientManager(im)removeSocketWithLabel:"></a>
|
||||
<a name="//apple_ref/swift/Method/removeSocket(withLabel:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO19SocketClientManager12removeSocketFT9withLabelSS_GSqCS_14SocketIOClient_">removeSocket(withLabel:)</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketClientManager(im)removeSocketWithLabel:">removeSocket(withLabel:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -388,9 +382,9 @@ manager["room1"]?.emit("hello")
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO19SocketClientManager12removeSocketFCS_14SocketIOClientGSqS1__"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketClientManager(im)removeSocket:"></a>
|
||||
<a name="//apple_ref/swift/Method/removeSocket(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO19SocketClientManager12removeSocketFCS_14SocketIOClientGSqS1__">removeSocket(_:)</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketClientManager(im)removeSocket:">removeSocket(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -438,9 +432,9 @@ manager["room1"]?.emit("hello")
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO19SocketClientManager13removeSocketsFT_T_"></a>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketClientManager(im)removeSockets"></a>
|
||||
<a name="//apple_ref/swift/Method/removeSockets()" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO19SocketClientManager13removeSocketsFT_T_">removeSockets()</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketClientManager(im)removeSockets">removeSockets()</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -470,8 +464,8 @@ manager["room1"]?.emit("hello")
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-10-05)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.4</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
+458
-259
File diff suppressed because it is too large.
Load diff
+750
-670
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,362 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SocketRawAckView Class Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Class/SocketRawAckView" class="dashAnchor"></a>
|
||||
|
||||
<a title="SocketRawAckView Class Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SocketRawAckView Class Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketRawAckView</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketRawAckView</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">ack</span><span class="o">.</span><span class="n">rawEmitView</span><span class="o">.</span><span class="nf">with</span><span class="p">(</span><span class="n">myObject</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A10RawAckViewC4withyyAA0A4Data_pd_tF"></a>
|
||||
<a name="//apple_ref/swift/Method/with(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A10RawAckViewC4withyyAA0A4Data_pd_tF">with(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Call to ack receiving this event.</p>
|
||||
|
||||
<p>If an error occurs trying to transform <code>items</code> into their socket representation, a <code><a href="../Enums/SocketClientEvent.html#/s:8SocketIO0A11ClientEventO5erroryA2CmF">SocketClientEvent.error</a></code>
|
||||
will be emitted. The structure of the error data is <code>[ackNum, items, theError]</code></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">with</span><span class="p">(</span><span class="n">_</span> <span class="nv">items</span><span class="p">:</span> <span class="kt"><a href="../Protocols/SocketData.html">SocketData</a></span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>items</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A variable number of items to send when acking.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketRawAckView(im)with:"></a>
|
||||
<a name="//apple_ref/swift/Method/with(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketRawAckView(im)with:">with(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Call to ack receiving this event.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">with</span><span class="p">(</span><span class="n">_</span> <span class="nv">items</span><span class="p">:</span> <span class="p">[</span><span class="kt">Any</span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>items</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An array of items to send when acking. Use <code>[]</code> to send nothing.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -0,0 +1,532 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SocketRawView Class Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Class/SocketRawView" class="dashAnchor"></a>
|
||||
|
||||
<a title="SocketRawView Class Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SocketRawView Class Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketRawView</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SocketRawView</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="n">rawEmitView</span><span class="o">.</span><span class="nf">emit</span><span class="p">(</span><span class="s">"myEvent"</span><span class="p">,</span> <span class="n">myObject</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A7RawViewC4emityySS_AA0A4Data_pdtF"></a>
|
||||
<a name="//apple_ref/swift/Method/emit(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A7RawViewC4emityySS_AA0A4Data_pdtF">emit(_:<wbr>_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Send an event to the server, with optional data items.</p>
|
||||
|
||||
<p>If an error occurs trying to transform <code>items</code> into their socket representation, a <code><a href="../Enums/SocketClientEvent.html#/s:8SocketIO0A11ClientEventO5erroryA2CmF">SocketClientEvent.error</a></code>
|
||||
will be emitted. The structure of the error data is <code>[eventName, items, theError]</code></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">emit</span><span class="p">(</span><span class="n">_</span> <span class="nv">event</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">_</span> <span class="nv">items</span><span class="p">:</span> <span class="kt"><a href="../Protocols/SocketData.html">SocketData</a></span><span class="o">...</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>event</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The event to send.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>items</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The items to send with this event. May be left out.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketRawView(im)emit:with:"></a>
|
||||
<a name="//apple_ref/swift/Method/emit(_:with:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketRawView(im)emit:with:">emit(_:<wbr>with:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Same as emit, but meant for Objective-C</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">emit</span><span class="p">(</span><span class="n">_</span> <span class="nv">event</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">with</span> <span class="nv">items</span><span class="p">:</span> <span class="p">[</span><span class="kt">Any</span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>event</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The event to send.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>items</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The items to send with this event. Send an empty array to send no data.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A7RawViewC11emitWithAckyAA02OnG8CallbackCSS_AA0A4Data_pdtF"></a>
|
||||
<a name="//apple_ref/swift/Method/emitWithAck(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A7RawViewC11emitWithAckyAA02OnG8CallbackCSS_AA0A4Data_pdtF">emitWithAck(_:<wbr>_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Sends a message to the server, requesting an ack.</p>
|
||||
|
||||
<p><strong>NOTE</strong>: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
Check that your server’s api will ack the event being sent.</p>
|
||||
|
||||
<p>If an error occurs trying to transform <code>items</code> into their socket representation, a <code><a href="../Enums/SocketClientEvent.html#/s:8SocketIO0A11ClientEventO5erroryA2CmF">SocketClientEvent.error</a></code>
|
||||
will be emitted. The structure of the error data is <code>[eventName, items, theError]</code></p>
|
||||
|
||||
<p>Example:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">emitWithAck</span><span class="p">(</span><span class="s">"myEvent"</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="nf">timingOut</span><span class="p">(</span><span class="nv">after</span><span class="p">:</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span><span class="n">data</span> <span class="k">in</span>
|
||||
<span class="o">...</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">emitWithAck</span><span class="p">(</span><span class="n">_</span> <span class="nv">event</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">_</span> <span class="nv">items</span><span class="p">:</span> <span class="kt"><a href="../Protocols/SocketData.html">SocketData</a></span><span class="o">...</span><span class="p">)</span> <span class="o">-></span> <span class="kt"><a href="../Classes/OnAckCallback.html">OnAckCallback</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>event</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The event to send.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>items</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The items to send with this event. May be left out.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>An <code><a href="../Classes/OnAckCallback.html">OnAckCallback</a></code>. You must call the <code>timingOut(after:)</code> method before the event will be sent.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(cs)SocketRawView(im)emitWithAck:with:"></a>
|
||||
<a name="//apple_ref/swift/Method/emitWithAck(_:with:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(cs)SocketRawView(im)emitWithAck:with:">emitWithAck(_:<wbr>with:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Same as emitWithAck, but for Objective-C</p>
|
||||
|
||||
<p><strong>NOTE</strong>: It is up to the server send an ack back, just calling this method does not mean the server will ack.
|
||||
Check that your server’s api will ack the event being sent.</p>
|
||||
|
||||
<p>Example:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">emitWithAck</span><span class="p">(</span><span class="s">"myEvent"</span><span class="p">,</span> <span class="nv">with</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="o">.</span><span class="nf">timingOut</span><span class="p">(</span><span class="nv">after</span><span class="p">:</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span><span class="n">data</span> <span class="k">in</span>
|
||||
<span class="o">...</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">emitWithAck</span><span class="p">(</span><span class="n">_</span> <span class="nv">event</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">with</span> <span class="nv">items</span><span class="p">:</span> <span class="p">[</span><span class="kt">Any</span><span class="p">])</span> <span class="o">-></span> <span class="kt"><a href="../Classes/OnAckCallback.html">OnAckCallback</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>event</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The event to send.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>items</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The items to send with this event. Use <code>[]</code> to send nothing.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>An <code><a href="../Classes/OnAckCallback.html">OnAckCallback</a></code>. You must call the <code>timingOut(after:)</code> method before the event will be sent.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,914 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>WebSocket Class Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Class/WebSocket" class="dashAnchor"></a>
|
||||
|
||||
<a title="WebSocket Class Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
WebSocket Class Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>WebSocket</h1>
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:OC8SocketIO9WebSocket9CloseCode"></a>
|
||||
<a name="//apple_ref/swift/Enum/CloseCode" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:OC8SocketIO9WebSocket9CloseCode">CloseCode</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
<a href="../Classes/WebSocket/CloseCode.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:ZvC8SocketIO9WebSocket11ErrorDomainSS"></a>
|
||||
<a name="//apple_ref/swift/Variable/ErrorDomain" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:ZvC8SocketIO9WebSocket11ErrorDomainSS">ErrorDomain</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket13callbackQueueCSo13DispatchQueue"></a>
|
||||
<a name="//apple_ref/swift/Property/callbackQueue" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket13callbackQueueCSo13DispatchQueue">callbackQueue</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Delegates"></a>
|
||||
<a name="//apple_ref/swift/Section/Delegates" class="dashAnchor"></a>
|
||||
<a href="#/Delegates">
|
||||
<h3 class="section-name">Delegates</h3>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket8delegateXwGSqPS_17WebSocketDelegate__"></a>
|
||||
<a name="//apple_ref/swift/Property/delegate" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket8delegateXwGSqPS_17WebSocketDelegate__">delegate</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Responds to callback about new messages coming in over the WebSocket
|
||||
and also connection/disconnect messages.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="k">weak</span> <span class="k">var</span> <span class="nv">delegate</span><span class="p">:</span> <span class="kt"><a href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a></span><span class="p">?</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket12pongDelegateXwGSqPS_21WebSocketPongDelegate__"></a>
|
||||
<a name="//apple_ref/swift/Property/pongDelegate" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket12pongDelegateXwGSqPS_21WebSocketPongDelegate__">pongDelegate</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Receives a callback for each pong message recived.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="k">weak</span> <span class="k">var</span> <span class="nv">pongDelegate</span><span class="p">:</span> <span class="kt"><a href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a></span><span class="p">?</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Block%20based%20API."></a>
|
||||
<a name="//apple_ref/swift/Section/Block based API." class="dashAnchor"></a>
|
||||
<a href="#/Block%20based%20API.">
|
||||
<h3 class="section-name">Block based API.</h3>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket9onConnectGSqFT_T__"></a>
|
||||
<a name="//apple_ref/swift/Property/onConnect" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket9onConnectGSqFT_T__">onConnect</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket12onDisconnectGSqFGSqCSo7NSError_T__"></a>
|
||||
<a name="//apple_ref/swift/Property/onDisconnect" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket12onDisconnectGSqFGSqCSo7NSError_T__">onDisconnect</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket6onTextGSqFSST__"></a>
|
||||
<a name="//apple_ref/swift/Property/onText" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket6onTextGSqFSST__">onText</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket6onDataGSqFV10Foundation4DataT__"></a>
|
||||
<a name="//apple_ref/swift/Property/onData" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket6onDataGSqFV10Foundation4DataT__">onData</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket6onPongGSqFGSqV10Foundation4Data_T__"></a>
|
||||
<a name="//apple_ref/swift/Property/onPong" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket6onPongGSqFGSqV10Foundation4Data_T__">onPong</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket7headersGVs10DictionarySSSS_"></a>
|
||||
<a name="//apple_ref/swift/Property/headers" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket7headersGVs10DictionarySSSS_">headers</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket11voipEnabledSb"></a>
|
||||
<a name="//apple_ref/swift/Property/voipEnabled" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket11voipEnabledSb">voipEnabled</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket24disableSSLCertValidationSb"></a>
|
||||
<a name="//apple_ref/swift/Property/disableSSLCertValidation" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket24disableSSLCertValidationSb">disableSSLCertValidation</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket8securityGSqPS_17SSLTrustValidator__"></a>
|
||||
<a name="//apple_ref/swift/Property/security" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket8securityGSqPS_17SSLTrustValidator__">security</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket22enabledSSLCipherSuitesGSqGSaVs6UInt32__"></a>
|
||||
<a name="//apple_ref/swift/Property/enabledSSLCipherSuites" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket22enabledSSLCipherSuitesGSqGSaVs6UInt32__">enabledSSLCipherSuites</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket6originGSqSS_"></a>
|
||||
<a name="//apple_ref/swift/Property/origin" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket6originGSqSS_">origin</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket7timeoutSi"></a>
|
||||
<a name="//apple_ref/swift/Property/timeout" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket7timeoutSi">timeout</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket11isConnectedSb"></a>
|
||||
<a name="//apple_ref/swift/Property/isConnected" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket11isConnectedSb">isConnected</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO9WebSocket10currentURLV10Foundation3URL"></a>
|
||||
<a name="//apple_ref/swift/Property/currentURL" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO9WebSocket10currentURLV10Foundation3URL">currentURL</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Private"></a>
|
||||
<a name="//apple_ref/swift/Section/Private" class="dashAnchor"></a>
|
||||
<a href="#/Private">
|
||||
<h3 class="section-name">Private</h3>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO9WebSocketcFT3urlV10Foundation3URL9protocolsGSqGSaSS___S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(url:protocols:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO9WebSocketcFT3urlV10Foundation3URL9protocolsGSqGSaSS___S0_">init(url:protocols:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Used for setting protocols.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="kt">URL</span><span class="p">,</span> <span class="nv">protocols</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO9WebSocketcFT3urlV10Foundation3URL13writeQueueQOSOSC16QualityOfService9protocolsGSqGSaSS___S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(url:writeQueueQOS:protocols:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO9WebSocketcFT3urlV10Foundation3URL13writeQueueQOSOSC16QualityOfService9protocolsGSqGSaSS___S0_">init(url:writeQueueQOS:protocols:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO9WebSocket7connectFT_T_"></a>
|
||||
<a name="//apple_ref/swift/Method/connect()" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO9WebSocket7connectFT_T_">connect()</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Connect to the WebSocket server on a background thread.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">func</span> <span class="nf">connect</span><span class="p">()</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO9WebSocket10disconnectFT12forceTimeoutGSqSd_9closeCodeVs6UInt16_T_"></a>
|
||||
<a name="//apple_ref/swift/Method/disconnect(forceTimeout:closeCode:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO9WebSocket10disconnectFT12forceTimeoutGSqSd_9closeCodeVs6UInt16_T_">disconnect(forceTimeout:closeCode:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Disconnect from the server. I send a Close control frame to the server, then expect the server to respond with a Close control frame and close the socket from its end. I notify my delegate once the socket has been closed.
|
||||
If you supply a non-nil <code>forceTimeout</code>, I wait at most that long (in seconds) for the server to close the socket. After the timeout expires, I close the socket and notify my delegate.
|
||||
If you supply a zero (or negative) <code>forceTimeout</code>, I immediately close the socket (without sending a Close control frame) and notify my delegate.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">func</span> <span class="nf">disconnect</span><span class="p">(</span><span class="nv">forceTimeout</span><span class="p">:</span> <span class="kt">TimeInterval</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">closeCode</span><span class="p">:</span> <span class="kt">UInt16</span> <span class="o">=</span> <span class="kt"><a href="../Classes/WebSocket/CloseCode.html">CloseCode</a></span><span class="o">.</span><span class="n">normal</span><span class="o">.</span><span class="n">rawValue</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>forceTimeout</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Maximum time to wait for the server to close the socket.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>closeCode</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The code to send on disconnect. The default is the normal close code for cleanly disconnecting a webSocket.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO9WebSocket5writeFT6stringSS10completionGSqFT_T___T_"></a>
|
||||
<a name="//apple_ref/swift/Method/write(string:completion:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO9WebSocket5writeFT6stringSS10completionGSqFT_T___T_">write(string:completion:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Write a string to the websocket. This sends it as a text frame.
|
||||
If you supply a non-nil completion block, I will perform it when the write completes.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">func</span> <span class="nf">write</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">(()</span> <span class="o">-></span> <span class="p">())?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>string</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The string to write.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>completion</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The (optional) completion handler.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO9WebSocket5writeFT4dataV10Foundation4Data10completionGSqFT_T___T_"></a>
|
||||
<a name="//apple_ref/swift/Method/write(data:completion:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO9WebSocket5writeFT4dataV10Foundation4Data10completionGSqFT_T___T_">write(data:completion:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Write binary data to the websocket. This sends it as a binary frame.
|
||||
If you supply a non-nil completion block, I will perform it when the write completes.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">func</span> <span class="nf">write</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">(()</span> <span class="o">-></span> <span class="p">())?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>data</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The data to write.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>completion</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The (optional) completion handler.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO9WebSocket5writeFT4pingV10Foundation4Data10completionGSqFT_T___T_"></a>
|
||||
<a name="//apple_ref/swift/Method/write(ping:completion:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO9WebSocket5writeFT4pingV10Foundation4Data10completionGSqFT_T___T_">write(ping:completion:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>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. <a href="http://youtu.be/Eu5ZJELRiJ8?t=42s">http://youtu.be/Eu5ZJELRiJ8?t=42s</a></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">func</span> <span class="nf">write</span><span class="p">(</span><span class="nv">ping</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">(()</span> <span class="o">-></span> <span class="p">())?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO9WebSocket6streamFTCSo6Stream6handleVS1_5Event_T_"></a>
|
||||
<a name="//apple_ref/swift/Method/stream(_:handle:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO9WebSocket6streamFTCSo6Stream6handleVS1_5Event_T_">stream(_:handle:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Delegate for the stream methods. Processes incoming bytes</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="n">open</span> <span class="kd">func</span> <span class="nf">stream</span><span class="p">(</span><span class="n">_</span> <span class="nv">aStream</span><span class="p">:</span> <span class="kt">Stream</span><span class="p">,</span> <span class="n">handle</span> <span class="nv">eventCode</span><span class="p">:</span> <span class="kt">Stream</span><span class="o">.</span><span class="kt">Event</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,376 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>CloseCode Enum Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../../js/jquery.min.js" defer></script>
|
||||
<script src="../../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../../js/lunr.min.js" defer></script>
|
||||
<script src="../../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/CloseCode" class="dashAnchor"></a>
|
||||
|
||||
<a title="CloseCode Enum Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../../index.html">
|
||||
SocketIO Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../../img/carat.png" />
|
||||
CloseCode Enum Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/WebSocket.html">WebSocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Enums.html">Enums</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Structs.html">Structs</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../../Typealiases.html">Typealiases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>CloseCode</h1>
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FOC8SocketIO9WebSocket9CloseCode6normalFMS1_S1_"></a>
|
||||
<a name="//apple_ref/swift/Element/normal" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FOC8SocketIO9WebSocket9CloseCode6normalFMS1_S1_">normal</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FOC8SocketIO9WebSocket9CloseCode9goingAwayFMS1_S1_"></a>
|
||||
<a name="//apple_ref/swift/Element/goingAway" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FOC8SocketIO9WebSocket9CloseCode9goingAwayFMS1_S1_">goingAway</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FOC8SocketIO9WebSocket9CloseCode13protocolErrorFMS1_S1_"></a>
|
||||
<a name="//apple_ref/swift/Element/protocolError" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FOC8SocketIO9WebSocket9CloseCode13protocolErrorFMS1_S1_">protocolError</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FOC8SocketIO9WebSocket9CloseCode21protocolUnhandledTypeFMS1_S1_"></a>
|
||||
<a name="//apple_ref/swift/Element/protocolUnhandledType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FOC8SocketIO9WebSocket9CloseCode21protocolUnhandledTypeFMS1_S1_">protocolUnhandledType</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FOC8SocketIO9WebSocket9CloseCode16noStatusReceivedFMS1_S1_"></a>
|
||||
<a name="//apple_ref/swift/Element/noStatusReceived" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FOC8SocketIO9WebSocket9CloseCode16noStatusReceivedFMS1_S1_">noStatusReceived</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FOC8SocketIO9WebSocket9CloseCode8encodingFMS1_S1_"></a>
|
||||
<a name="//apple_ref/swift/Element/encoding" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FOC8SocketIO9WebSocket9CloseCode8encodingFMS1_S1_">encoding</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FOC8SocketIO9WebSocket9CloseCode14policyViolatedFMS1_S1_"></a>
|
||||
<a name="//apple_ref/swift/Element/policyViolated" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FOC8SocketIO9WebSocket9CloseCode14policyViolatedFMS1_S1_">policyViolated</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FOC8SocketIO9WebSocket9CloseCode13messageTooBigFMS1_S1_"></a>
|
||||
<a name="//apple_ref/swift/Element/messageTooBig" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FOC8SocketIO9WebSocket9CloseCode13messageTooBigFMS1_S1_">messageTooBig</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
+230
-128
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Enums Reference</title>
|
||||
<title>Enumerations Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,15 +14,16 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
|
||||
|
||||
<a title="Enums Reference"></a>
|
||||
<a title="Enumerations Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -37,33 +38,38 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Enums Reference
|
||||
Enumerations Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -71,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -108,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -116,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -133,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -168,9 +228,9 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Enums</h1>
|
||||
<p>The following enums are available globally.</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>Enumerations</h1>
|
||||
<p>The following enumerations are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -182,73 +242,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O8SocketIO17SocketClientEvent"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketClientEvent" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O8SocketIO17SocketClientEvent">SocketClientEvent</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The set of events that are generated by the client.</p>
|
||||
|
||||
<a href="Enums/SocketClientEvent.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketClientEvent</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O8SocketIO20SocketIOClientStatus"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketIOClientStatus" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O8SocketIO20SocketIOClientStatus">SocketIOClientStatus</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents the state of the client.</p>
|
||||
|
||||
<a href="Enums/SocketIOClientStatus.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">@objc</span> <span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketIOClientStatus</span> <span class="p">:</span> <span class="kt">Int</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O8SocketIO15SocketAckStatus"></a>
|
||||
<a name="/s:8SocketIO0A9AckStatusO"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketAckStatus" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O8SocketIO15SocketAckStatus">SocketAckStatus</a>
|
||||
<a class="token" href="#/s:8SocketIO0A9AckStatusO">SocketAckStatus</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -264,23 +260,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketAckStatus</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketAckStatus</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O8SocketIO22SocketEnginePacketType"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketEnginePacketType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O8SocketIO22SocketEnginePacketType">SocketEnginePacketType</a>
|
||||
<a name="/s:8SocketIO0A9IOVersionO"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketIOVersion" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A9IOVersionO">SocketIOVersion</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -288,31 +280,27 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents the type of engine.io packet types.</p>
|
||||
<p>The socket.io version being used.</p>
|
||||
|
||||
<a href="Enums/SocketEnginePacketType.html" class="slightly-smaller">See more</a>
|
||||
<a href="Enums/SocketIOVersion.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">@objc</span> <span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketEnginePacketType</span> <span class="p">:</span> <span class="kt">Int</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketIOVersion</span> <span class="p">:</span> <span class="kt">Int</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O8SocketIO20SocketIOClientOption"></a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketIOClientOption" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O8SocketIO20SocketIOClientOption">SocketIOClientOption</a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO">SocketIOClientOption</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -328,7 +316,121 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketIOClientOption</span> <span class="p">:</span> <span class="kt">ClientOption</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketIOClientOption</span> <span class="p">:</span> <span class="kt">ClientOption</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A11ClientEventO"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketClientEvent" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO">SocketClientEvent</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The set of events that are generated by the client.</p>
|
||||
|
||||
<a href="Enums/SocketClientEvent.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketClientEvent</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@E@SocketIOStatus"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketIOStatus" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketIOStatus">SocketIOStatus</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents state of a manager or client.</p>
|
||||
|
||||
<a href="Enums/SocketIOStatus.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketIOStatus</span> <span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@E@SocketEnginePacketType"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketEnginePacketType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketEnginePacketType">SocketEnginePacketType</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents the type of engine.io packet types.</p>
|
||||
|
||||
<a href="Enums/SocketEnginePacketType.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketEnginePacketType</span> <span class="p">:</span> <span class="kt">Int</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A13ParsableErrorO"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketParsableError" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A13ParsableErrorO">SocketParsableError</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Errors that can be thrown during parsing.</p>
|
||||
|
||||
<a href="Enums/SocketParsableError.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketParsableError</span> <span class="p">:</span> <span class="kt">Error</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -343,8 +445,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
+169
-46
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SocketAckStatus Enum Reference</title>
|
||||
<title>SocketAckStatus Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
<a name="//apple_ref/swift/Enum/SocketAckStatus" class="dashAnchor"></a>
|
||||
|
||||
<a title="SocketAckStatus Enum Reference"></a>
|
||||
<a title="SocketAckStatus Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -38,33 +38,38 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SocketAckStatus Enum Reference
|
||||
SocketAckStatus Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,11 +228,12 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketAckStatus</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketAckStatus</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketAckStatus</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -185,13 +245,22 @@
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Cases"></a>
|
||||
<a name="//apple_ref/swift/Section/Cases" class="dashAnchor"></a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Cases"></a>
|
||||
<h3 class="section-name"><p>Cases</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO15SocketAckStatus5noAckFMS0_S0_"></a>
|
||||
<a name="/s:8SocketIO0A9AckStatusO02noC0yA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/noAck" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO15SocketAckStatus5noAckFMS0_S0_">noAck</a>
|
||||
<a class="token" href="#/s:8SocketIO0A9AckStatusO02noC0yA2CmF">noAck</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -206,7 +275,61 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">noAck</span> <span class="o">=</span> <span class="s">"NO ACK"</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">noAck</span> <span class="o">=</span> <span class="s">"NO ACK"</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A9AckStatusO2eeoiySbSS_ACtFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A9AckStatusO2eeoiySbSS_ACtFZ">==(_:<wbr>_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Tests whether a string is equal to a given SocketAckStatus</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">SocketAckStatus</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A9AckStatusO2eeoiySbAC_SStFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A9AckStatusO2eeoiySbAC_SStFZ">==(_:<wbr>_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Tests whether a string is equal to a given SocketAckStatus</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">SocketAckStatus</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -221,8 +344,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SocketClientEvent Enum Reference</title>
|
||||
<title>SocketClientEvent Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
<a name="//apple_ref/swift/Enum/SocketClientEvent" class="dashAnchor"></a>
|
||||
|
||||
<a title="SocketClientEvent Enum Reference"></a>
|
||||
<a title="SocketClientEvent Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -38,33 +38,38 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SocketClientEvent Enum Reference
|
||||
SocketClientEvent Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,11 +228,12 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketClientEvent</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketClientEvent</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketClientEvent</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -185,13 +245,22 @@
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Cases"></a>
|
||||
<a name="//apple_ref/swift/Section/Cases" class="dashAnchor"></a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Cases"></a>
|
||||
<h3 class="section-name"><p>Cases</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO17SocketClientEvent7connectFMS0_S0_"></a>
|
||||
<a name="/s:8SocketIO0A11ClientEventO7connectyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/connect" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO17SocketClientEvent7connectFMS0_S0_">connect</a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO7connectyA2CmF">connect</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -199,30 +268,32 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Emitted when the client connects. This is also called on a successful reconnection.</p>
|
||||
<p>Emitted when the client connects. This is also called on a successful reconnection. A connect event gets one
|
||||
data item: the namespace that was connected to.</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">on</span><span class="p">(</span><span class="nv">clientEvent</span><span class="p">:</span> <span class="o">.</span><span class="n">connect</span><span class="p">)</span> <span class="p">{</span><span class="n">data</span><span class="p">,</span> <span class="n">ack</span> <span class="k">in</span>
|
||||
<span class="k">guard</span> <span class="k">let</span> <span class="nv">nsp</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">as?</span> <span class="kt">String</span> <span class="k">else</span> <span class="p">{</span> <span class="k">return</span> <span class="p">}</span>
|
||||
<span class="c1">// Some logic using the nsp</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">connect</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">connect</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO17SocketClientEvent10disconnectFMS0_S0_"></a>
|
||||
<a name="/s:8SocketIO0A11ClientEventO10disconnectyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/disconnect" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO17SocketClientEvent10disconnectFMS0_S0_">disconnect</a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO10disconnectyA2CmF">disconnect</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -230,30 +301,32 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Called when the socket has disconnected and will not attempt to try to reconnect.</p>
|
||||
<p>Emitted when the socket has disconnected and will not attempt to try to reconnect.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">on</span><span class="p">(</span><span class="nv">clientEvent</span><span class="p">:</span> <span class="o">.</span><span class="n">disconnect</span><span class="p">)</span> <span class="p">{</span><span class="n">data</span><span class="p">,</span> <span class="n">ack</span> <span class="k">in</span>
|
||||
<span class="c1">// Some cleanup logic</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">disconnect</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">disconnect</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO17SocketClientEvent5errorFMS0_S0_"></a>
|
||||
<a name="/s:8SocketIO0A11ClientEventO5erroryA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/error" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO17SocketClientEvent5errorFMS0_S0_">error</a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO5erroryA2CmF">error</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -261,30 +334,98 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Called when an error occurs.</p>
|
||||
<p>Emitted when an error occurs.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">on</span><span class="p">(</span><span class="nv">clientEvent</span><span class="p">:</span> <span class="o">.</span><span class="n">error</span><span class="p">)</span> <span class="p">{</span><span class="n">data</span><span class="p">,</span> <span class="n">ack</span> <span class="k">in</span>
|
||||
<span class="c1">// Some logging</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">error</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">error</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO17SocketClientEvent9reconnectFMS0_S0_"></a>
|
||||
<a name="/s:8SocketIO0A11ClientEventO4pingyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/ping" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO4pingyA2CmF">ping</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Emitted whenever the engine sends a ping.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">on</span><span class="p">(</span><span class="nv">clientEvent</span><span class="p">:</span> <span class="o">.</span><span class="n">ping</span><span class="p">)</span> <span class="p">{</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="k">in</span>
|
||||
<span class="c1">// Maybe keep track of latency?</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">ping</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A11ClientEventO4pongyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/pong" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO4pongyA2CmF">pong</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Emitted whenever the engine gets a pong.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">on</span><span class="p">(</span><span class="nv">clientEvent</span><span class="p">:</span> <span class="o">.</span><span class="n">pong</span><span class="p">)</span> <span class="p">{</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="k">in</span>
|
||||
<span class="c1">// Maybe keep track of latency?</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">pong</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A11ClientEventO9reconnectyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/reconnect" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO17SocketClientEvent9reconnectFMS0_S0_">reconnect</a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO9reconnectyA2CmF">reconnect</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -292,30 +433,32 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Called when the client begins the reconnection process.</p>
|
||||
<p>Emitted when the client begins the reconnection process.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">on</span><span class="p">(</span><span class="nv">clientEvent</span><span class="p">:</span> <span class="o">.</span><span class="n">reconnect</span><span class="p">)</span> <span class="p">{</span><span class="n">data</span><span class="p">,</span> <span class="n">ack</span> <span class="k">in</span>
|
||||
<span class="c1">// Some reconnect event logic</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">reconnect</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">reconnect</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO17SocketClientEvent16reconnectAttemptFMS0_S0_"></a>
|
||||
<a name="/s:8SocketIO0A11ClientEventO16reconnectAttemptyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/reconnectAttempt" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO17SocketClientEvent16reconnectAttemptFMS0_S0_">reconnectAttempt</a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO16reconnectAttemptyA2CmF">reconnectAttempt</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -323,30 +466,32 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Called each time the client tries to reconnect to the server.</p>
|
||||
<p>Emitted each time the client tries to reconnect to the server.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">on</span><span class="p">(</span><span class="nv">clientEvent</span><span class="p">:</span> <span class="o">.</span><span class="n">reconnectAttempt</span><span class="p">)</span> <span class="p">{</span><span class="n">data</span><span class="p">,</span> <span class="n">ack</span> <span class="k">in</span>
|
||||
<span class="c1">// Some reconnect attempt logging</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">reconnectAttempt</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">reconnectAttempt</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO17SocketClientEvent12statusChangeFMS0_S0_"></a>
|
||||
<a name="/s:8SocketIO0A11ClientEventO12statusChangeyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/statusChange" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO17SocketClientEvent12statusChangeFMS0_S0_">statusChange</a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO12statusChangeyA2CmF">statusChange</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -354,14 +499,57 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Called every time there is a change in the client’s status.</p>
|
||||
<p>Emitted every time there is a change in the client’s status.</p>
|
||||
|
||||
<p>The payload for data is [SocketIOClientStatus, Int]. Where the second item is the raw value. Use the second one
|
||||
if you are working in Objective-C.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">on</span><span class="p">(</span><span class="nv">clientEvent</span><span class="p">:</span> <span class="o">.</span><span class="n">statusChange</span><span class="p">)</span> <span class="p">{</span><span class="n">data</span><span class="p">,</span> <span class="n">ack</span> <span class="k">in</span>
|
||||
<span class="c1">// Some status changing logging</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">statusChange</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">statusChange</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A11ClientEventO16websocketUpgradeyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/websocketUpgrade" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ClientEventO16websocketUpgradeyA2CmF">websocketUpgrade</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Emitted when when upgrading the http connection to a websocket connection.</p>
|
||||
|
||||
<p>Usage:</p>
|
||||
<pre class="highlight swift"><code><span class="n">socket</span><span class="o">.</span><span class="nf">on</span><span class="p">(</span><span class="nv">clientEvent</span><span class="p">:</span> <span class="o">.</span><span class="n">websocketUpgrade</span><span class="p">)</span> <span class="p">{</span><span class="n">data</span><span class="p">,</span> <span class="n">ack</span> <span class="k">in</span>
|
||||
<span class="k">let</span> <span class="nv">headers</span> <span class="o">=</span> <span class="p">(</span><span class="n">data</span> <span class="k">as</span> <span class="p">[</span><span class="kt">Any</span><span class="p">])[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="c1">// Some header logic</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">websocketUpgrade</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -376,8 +564,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SocketEnginePacketType Enum Reference</title>
|
||||
<title>SocketEnginePacketType Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
<a name="//apple_ref/swift/Enum/SocketEnginePacketType" class="dashAnchor"></a>
|
||||
|
||||
<a title="SocketEnginePacketType Enum Reference"></a>
|
||||
<a title="SocketEnginePacketType Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -38,33 +38,38 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SocketEnginePacketType Enum Reference
|
||||
SocketEnginePacketType Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,11 +228,13 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketEnginePacketType</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">@objc</span> <span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketEnginePacketType</span> <span class="p">:</span> <span class="kt">Int</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketEnginePacketType</span> <span class="p">:</span> <span class="kt">Int</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -189,9 +250,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO22SocketEnginePacketType4openFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeOpen"></a>
|
||||
<a name="//apple_ref/swift/Element/open" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO22SocketEnginePacketType4openFMS0_S0_">open</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeOpen">open</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -206,23 +267,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">open</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="kd">open</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO22SocketEnginePacketType5closeFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeClose"></a>
|
||||
<a name="//apple_ref/swift/Element/close" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO22SocketEnginePacketType5closeFMS0_S0_">close</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeClose">close</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -237,23 +294,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">close</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">close</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO22SocketEnginePacketType4pingFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypePing"></a>
|
||||
<a name="//apple_ref/swift/Element/ping" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO22SocketEnginePacketType4pingFMS0_S0_">ping</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypePing">ping</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -268,23 +321,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">ping</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">ping</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO22SocketEnginePacketType4pongFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypePong"></a>
|
||||
<a name="//apple_ref/swift/Element/pong" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO22SocketEnginePacketType4pongFMS0_S0_">pong</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypePong">pong</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -299,23 +348,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">pong</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">pong</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO22SocketEnginePacketType7messageFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeMessage"></a>
|
||||
<a name="//apple_ref/swift/Element/message" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO22SocketEnginePacketType7messageFMS0_S0_">message</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeMessage">message</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -330,23 +375,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">message</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">message</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO22SocketEnginePacketType7upgradeFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeUpgrade"></a>
|
||||
<a name="//apple_ref/swift/Element/upgrade" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO22SocketEnginePacketType7upgradeFMS0_S0_">upgrade</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeUpgrade">upgrade</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -361,23 +402,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">upgrade</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">upgrade</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO22SocketEnginePacketType4noopFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeNoop"></a>
|
||||
<a name="//apple_ref/swift/Element/noop" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO22SocketEnginePacketType4noopFMS0_S0_">noop</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketEnginePacketType@SocketEnginePacketTypeNoop">noop</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -392,7 +429,7 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">noop</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">noop</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -407,8 +444,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SocketIOClientOption Enum Reference</title>
|
||||
<title>SocketIOClientOption Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
<a name="//apple_ref/swift/Enum/SocketIOClientOption" class="dashAnchor"></a>
|
||||
|
||||
<a title="SocketIOClientOption Enum Reference"></a>
|
||||
<a title="SocketIOClientOption Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -38,33 +38,38 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SocketIOClientOption Enum Reference
|
||||
SocketIOClientOption Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,11 +228,12 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketIOClientOption</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketIOClientOption</span> <span class="p">:</span> <span class="kt">ClientOption</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketIOClientOption</span> <span class="p">:</span> <span class="kt">ClientOption</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -189,9 +249,36 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption13connectParamsFMS0_FGVs10DictionarySSP__S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/connectParams" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption13connectParamsFMS0_FGVs10DictionarySSP__S0_">connectParams</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO8compressyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/compress" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO8compressyA2CmF">compress</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>If given, the WebSocket transport will attempt to use compression.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">compress</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO13connectParamsyACSDySSypGcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/connectParams(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO13connectParamsyACSDySSypGcACmF">connectParams(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -206,23 +293,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">connectParams</span><span class="p">([</span><span class="kt">String</span><span class="p">:</span> <span class="kt">Any</span><span class="p">])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">connectParams</span><span class="p">([</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">Any</span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption7cookiesFMS0_FGSaCSo10HTTPCookie_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/cookies" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption7cookiesFMS0_FGSaCSo10HTTPCookie_S0_">cookies</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO7cookiesyACSaySo12NSHTTPCookieCGcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/cookies(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO7cookiesyACSaySo12NSHTTPCookieCGcACmF">cookies(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -237,54 +320,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">cookies</span><span class="p">([</span><span class="kt">HTTPCookie</span><span class="p">])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">cookies</span><span class="p">([</span><span class="kt">HTTPCookie</span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption16doubleEncodeUTF8FMS0_FSbS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/doubleEncodeUTF8" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption16doubleEncodeUTF8FMS0_FSbS0_">doubleEncodeUTF8</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Deprecated</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">doubleEncodeUTF8</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption12extraHeadersFMS0_FGVs10DictionarySSSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/extraHeaders" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption12extraHeadersFMS0_FGVs10DictionarySSSS_S0_">extraHeaders</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO12extraHeadersyACSDyS2SGcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/extraHeaders(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO12extraHeadersyACSDyS2SGcACmF">extraHeaders(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -299,23 +347,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">extraHeaders</span><span class="p">([</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">extraHeaders</span><span class="p">([</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">String</span><span class="p">])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption8forceNewFMS0_FSbS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/forceNew" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption8forceNewFMS0_FSbS0_">forceNew</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO8forceNewyACSbcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/forceNew(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO8forceNewyACSbcACmF">forceNew(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -331,23 +375,19 @@ or when you want to be sure no state from previous engines is being carried over
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">forceNew</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">forceNew</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption12forcePollingFMS0_FSbS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/forcePolling" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption12forcePollingFMS0_FSbS0_">forcePolling</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO12forcePollingyACSbcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/forcePolling(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO12forcePollingyACSbcACmF">forcePolling(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -362,23 +402,19 @@ or when you want to be sure no state from previous engines is being carried over
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">forcePolling</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">forcePolling</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption15forceWebsocketsFMS0_FSbS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/forceWebsockets" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption15forceWebsocketsFMS0_FSbS0_">forceWebsockets</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO15forceWebsocketsyACSbcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/forceWebsockets(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO15forceWebsocketsyACSbcACmF">forceWebsockets(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -393,23 +429,46 @@ or when you want to be sure no state from previous engines is being carried over
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">forceWebsockets</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">forceWebsockets</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption11handleQueueFMS0_FCSo13DispatchQueueS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/handleQueue" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption11handleQueueFMS0_FCSo13DispatchQueueS0_">handleQueue</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO16enableSOCKSProxyyACSbcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/enableSOCKSProxy(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO16enableSOCKSProxyyACSbcACmF">enableSOCKSProxy(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>If passed <code>true</code>, the WebSocket stream will be configured with the enableSOCKSProxy <code>true</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">enableSOCKSProxy</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO11handleQueueyACSo17OS_dispatch_queueCcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/handleQueue(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO11handleQueueyACSo17OS_dispatch_queueCcACmF">handleQueue(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -420,28 +479,26 @@ or when you want to be sure no state from previous engines is being carried over
|
||||
<p>The queue that all interaction with the client should occur on. This is the queue that event handlers are
|
||||
called on.</p>
|
||||
|
||||
<p><strong>This should be a serial queue! Concurrent queues are not supported and might cause crashes and races</strong>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">handleQueue</span><span class="p">(</span><span class="kt">DispatchQueue</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">handleQueue</span><span class="p">(</span><span class="kt">DispatchQueue</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption3logFMS0_FSbS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/log" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption3logFMS0_FSbS0_">log</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO3logyACSbcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/log(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO3logyACSbcACmF">log(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -456,23 +513,19 @@ called on.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">log</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">log</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption6loggerFMS0_FPS_12SocketLogger_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/logger" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption6loggerFMS0_FPS_12SocketLogger_S0_">logger</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO6loggeryAcA0A6Logger_pcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/logger(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO6loggeryAcA0A6Logger_pcACmF">logger(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -487,55 +540,19 @@ called on.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">logger</span><span class="p">(</span><span class="kt"><a href="../Protocols/SocketLogger.html">SocketLogger</a></span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">logger</span><span class="p">(</span><span class="kt"><a href="../Protocols/SocketLogger.html">SocketLogger</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption3nspFMS0_FSSS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/nsp" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption3nspFMS0_FSSS0_">nsp</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The namespace that this client should connect to. Can be changed during use using the <code>joinNamespace</code>
|
||||
and <code>leaveNamespace</code> methods on <code><a href="../Classes/SocketIOClient.html">SocketIOClient</a></code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">nsp</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption4pathFMS0_FSSS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/path" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption4pathFMS0_FSSS0_">path</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO4pathyACSScACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/path(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO4pathyACSScACmF">path(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -550,23 +567,19 @@ and <code>leaveNamespace</code> methods on <code><a href="../Classes/SocketIOCli
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">path</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">path</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption10reconnectsFMS0_FSbS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/reconnects" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption10reconnectsFMS0_FSbS0_">reconnects</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO10reconnectsyACSbcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/reconnects(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO10reconnectsyACSbcACmF">reconnects(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -582,23 +595,19 @@ over when reconnects happen.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">reconnects</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">reconnects</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption17reconnectAttemptsFMS0_FSiS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/reconnectAttempts" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption17reconnectAttemptsFMS0_FSiS0_">reconnectAttempts</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO17reconnectAttemptsyACSicACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/reconnectAttempts(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO17reconnectAttemptsyACSicACmF">reconnectAttempts(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -613,23 +622,19 @@ over when reconnects happen.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">reconnectAttempts</span><span class="p">(</span><span class="kt">Int</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">reconnectAttempts</span><span class="p">(</span><span class="kt">Int</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption13reconnectWaitFMS0_FSiS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/reconnectWait" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption13reconnectWaitFMS0_FSiS0_">reconnectWait</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO13reconnectWaityACSicACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/reconnectWait(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO13reconnectWaityACSicACmF">reconnectWait(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -637,30 +642,80 @@ over when reconnects happen.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The number of seconds to wait before reconnect attempts.</p>
|
||||
<p>The minimum number of seconds to wait before reconnect attempts.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">reconnectWait</span><span class="p">(</span><span class="kt">Int</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">reconnectWait</span><span class="p">(</span><span class="kt">Int</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption6secureFMS0_FSbS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/secure" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption6secureFMS0_FSbS0_">secure</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO16reconnectWaitMaxyACSicACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/reconnectWaitMax(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO16reconnectWaitMaxyACSicACmF">reconnectWaitMax(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The maximum number of seconds to wait before reconnect attempts.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">reconnectWaitMax</span><span class="p">(</span><span class="kt">Int</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO19randomizationFactoryACSdcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/randomizationFactor(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO19randomizationFactoryACSdcACmF">randomizationFactor(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The randomization factor for calculating reconnect jitter.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">randomizationFactor</span><span class="p">(</span><span class="kt">Double</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO6secureyACSbcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/secure(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO6secureyACSbcACmF">secure(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -675,23 +730,19 @@ over when reconnects happen.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">secure</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">secure</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption8securityFMS0_FCS_11SSLSecurityS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/security" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption8securityFMS0_FCS_11SSLSecurityS0_">security</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO8securityyAC10Starscream18CertificatePinning_pcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/security(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO8securityyAC10Starscream18CertificatePinning_pcACmF">security(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -706,23 +757,19 @@ over when reconnects happen.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">security</span><span class="p">(</span><span class="kt"><a href="../Classes/SSLSecurity.html">SSLSecurity</a></span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">security</span><span class="p">(</span><span class="kt">CertificatePinning</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption10selfSignedFMS0_FSbS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/selfSigned" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption10selfSignedFMS0_FSbS0_">selfSigned</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO10selfSignedyACSbcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/selfSigned(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO10selfSignedyACSbcACmF">selfSigned(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -737,23 +784,19 @@ over when reconnects happen.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">selfSigned</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">selfSigned</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption15sessionDelegateFMS0_FPSo18URLSessionDelegate_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/sessionDelegate" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption15sessionDelegateFMS0_FPSo18URLSessionDelegate_S0_">sessionDelegate</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO15sessionDelegateyACSo012NSURLSessionF0_pcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/sessionDelegate(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO15sessionDelegateyACSo012NSURLSessionF0_pcACmF">sessionDelegate(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -768,23 +811,19 @@ over when reconnects happen.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">sessionDelegate</span><span class="p">(</span><span class="kt">URLSessionDelegate</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">sessionDelegate</span><span class="p">(</span><span class="kt">URLSessionDelegate</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientOption11voipEnabledFMS0_FSbS0_"></a>
|
||||
<a name="//apple_ref/swift/Element/voipEnabled" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientOption11voipEnabledFMS0_FSbS0_">voipEnabled</a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO7versionyAcA0A9IOVersionOcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/version(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO7versionyAcA0A9IOVersionOcACmF">version(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -792,15 +831,14 @@ over when reconnects happen.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>If passed <code>true</code>, the WebSocket transport will try and use voip logic to keep network connections open in
|
||||
the background. <strong>This option is experimental as socket.io shouldn’t be used for background communication.</strong></p>
|
||||
<p>The version of socket.io being used. This should match the server version. Default is 3.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">voipEnabled</span><span class="p">(</span><span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">version</span><span class="p">(</span><span class="kt"><a href="../Enums/SocketIOVersion.html">SocketIOVersion</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -813,17 +851,19 @@ the background. <strong>This option is experimental as socket.io shouldn’t
|
||||
<div class="task-name-container">
|
||||
<a name="/Properties"></a>
|
||||
<a name="//apple_ref/swift/Section/Properties" class="dashAnchor"></a>
|
||||
<a href="#/Properties">
|
||||
<h3 class="section-name">Properties</h3>
|
||||
</a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Properties"></a>
|
||||
<h3 class="section-name"><p>Properties</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vO8SocketIO20SocketIOClientOption11descriptionSS"></a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vO8SocketIO20SocketIOClientOption11descriptionSS">description</a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -838,7 +878,7 @@ the background. <strong>This option is experimental as socket.io shouldn’t
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -851,17 +891,19 @@ the background. <strong>This option is experimental as socket.io shouldn’t
|
||||
<div class="task-name-container">
|
||||
<a name="/Operators"></a>
|
||||
<a name="//apple_ref/swift/Section/Operators" class="dashAnchor"></a>
|
||||
<a href="#/Operators">
|
||||
<h3 class="section-name">Operators</h3>
|
||||
</a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Operators"></a>
|
||||
<h3 class="section-name"><p>Operators</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:ZFO8SocketIO20SocketIOClientOptionoi2eeFTS0_S0__Sb"></a>
|
||||
<a name="/s:8SocketIO0A14IOClientOptionO2eeoiySbAC_ACtFZ"></a>
|
||||
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:ZFO8SocketIO20SocketIOClientOptionoi2eeFTS0_S0__Sb">==(_:_:)</a>
|
||||
<a class="token" href="#/s:8SocketIO0A14IOClientOptionO2eeoiySbAC_ACtFZ">==(_:<wbr>_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -876,7 +918,7 @@ the background. <strong>This option is experimental as socket.io shouldn’t
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span><span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">SocketIOClientOption</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">SocketIOClientOption</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">SocketIOClientOption</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">SocketIOClientOption</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -926,8 +968,8 @@ the background. <strong>This option is experimental as socket.io shouldn’t
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SocketIOClientStatus Enum Reference</title>
|
||||
<title>SocketIOClientStatus Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
<a name="//apple_ref/swift/Enum/SocketIOClientStatus" class="dashAnchor"></a>
|
||||
|
||||
<a title="SocketIOClientStatus Enum Reference"></a>
|
||||
<a title="SocketIOClientStatus Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -38,21 +38,26 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SocketIOClientStatus Enum Reference
|
||||
SocketIOClientStatus Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
@@ -71,30 +76,10 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -111,14 +96,14 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
@@ -134,33 +119,42 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -189,9 +183,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientStatus12notConnectedFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketIOClientStatus@SocketIOClientStatusNotConnected"></a>
|
||||
<a name="//apple_ref/swift/Element/notConnected" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientStatus12notConnectedFMS0_S0_">notConnected</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketIOClientStatus@SocketIOClientStatusNotConnected">notConnected</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -220,9 +214,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientStatus12disconnectedFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketIOClientStatus@SocketIOClientStatusDisconnected"></a>
|
||||
<a name="//apple_ref/swift/Element/disconnected" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientStatus12disconnectedFMS0_S0_">disconnected</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketIOClientStatus@SocketIOClientStatusDisconnected">disconnected</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -251,9 +245,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientStatus10connectingFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketIOClientStatus@SocketIOClientStatusConnecting"></a>
|
||||
<a name="//apple_ref/swift/Element/connecting" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientStatus10connectingFMS0_S0_">connecting</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketIOClientStatus@SocketIOClientStatusConnecting">connecting</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -282,9 +276,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO8SocketIO20SocketIOClientStatus9connectedFMS0_S0_"></a>
|
||||
<a name="/c:@M@SocketIO@E@SocketIOClientStatus@SocketIOClientStatusConnected"></a>
|
||||
<a name="//apple_ref/swift/Element/connected" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO8SocketIO20SocketIOClientStatus9connectedFMS0_S0_">connected</a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketIOClientStatus@SocketIOClientStatusConnected">connected</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -314,8 +308,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-10-05)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.4</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,449 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SocketIOStatus Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/SocketIOStatus" class="dashAnchor"></a>
|
||||
|
||||
<a title="SocketIOStatus Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SocketIOStatus Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketIOStatus</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketIOStatus</span> <span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Represents state of a manager or client.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Cases"></a>
|
||||
<a name="//apple_ref/swift/Section/Cases" class="dashAnchor"></a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Cases"></a>
|
||||
<h3 class="section-name"><p>Cases</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@E@SocketIOStatus@SocketIOStatusNotConnected"></a>
|
||||
<a name="//apple_ref/swift/Element/notConnected" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketIOStatus@SocketIOStatusNotConnected">notConnected</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The client/manager has never been connected. Or the client has been reset.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">notConnected</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@E@SocketIOStatus@SocketIOStatusDisconnected"></a>
|
||||
<a name="//apple_ref/swift/Element/disconnected" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketIOStatus@SocketIOStatusDisconnected">disconnected</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The client/manager was once connected, but not anymore.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">disconnected</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@E@SocketIOStatus@SocketIOStatusConnecting"></a>
|
||||
<a name="//apple_ref/swift/Element/connecting" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketIOStatus@SocketIOStatusConnecting">connecting</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The client/manager is in the process of connecting.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">connecting</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@E@SocketIOStatus@SocketIOStatusConnected"></a>
|
||||
<a name="//apple_ref/swift/Element/connected" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@E@SocketIOStatus@SocketIOStatusConnected">connected</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The client/manager is currently connected.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">connected</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Properties"></a>
|
||||
<a name="//apple_ref/swift/Section/Properties" class="dashAnchor"></a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Properties"></a>
|
||||
<h3 class="section-name"><p>Properties</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A8IOStatusO6activeSbvp"></a>
|
||||
<a name="//apple_ref/swift/Property/active" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A8IOStatusO6activeSbvp">active</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">active</span><span class="p">:</span> <span class="kt">Bool</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>True if this client/manager is connected/connecting to a server.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SSLCert Class Reference</title>
|
||||
<title>SocketIOVersion Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,16 +14,16 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Class/SSLCert" class="dashAnchor"></a>
|
||||
<a name="//apple_ref/swift/Enum/SocketIOVersion" class="dashAnchor"></a>
|
||||
|
||||
<a title="SSLCert Class Reference"></a>
|
||||
<a title="SocketIOVersion Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -38,33 +38,38 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SSLCert Class Reference
|
||||
SocketIOVersion Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,9 +228,16 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>SSLCert</h1>
|
||||
<p>Undocumented</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketIOVersion</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketIOVersion</span> <span class="p">:</span> <span class="kt">Int</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>The socket.io version being used.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -183,9 +249,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO7SSLCertcFT4dataV10Foundation4Data_S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(data:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO7SSLCertcFT4dataV10Foundation4Data_S0_">init(data:)</a>
|
||||
<a name="/s:8SocketIO0A9IOVersionO3twoyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/two" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A9IOVersionO3twoyA2CmF">two</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -193,49 +259,26 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Designated init for certificates</p>
|
||||
<p>socket.io 2, engine.io 3</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">two</span> <span class="o">=</span> <span class="mi">2</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>data</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>is the binary data of the certificate</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>a representation security object to be used with</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO7SSLCertcFT3keyCSo6SecKey_S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(key:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO7SSLCertcFT3keyCSo6SecKey_S0_">init(key:)</a>
|
||||
<a name="/s:8SocketIO0A9IOVersionO5threeyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/three" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A9IOVersionO5threeyA2CmF">three</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -243,40 +286,17 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Designated init for public keys</p>
|
||||
<p>socket.io 3, engine.io 4</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">key</span><span class="p">:</span> <span class="kt">SecKey</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">three</span> <span class="o">=</span> <span class="mi">3</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>key</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>is the public key to be used</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>a representation security object to be used with</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
@@ -288,8 +308,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
@@ -0,0 +1,352 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SocketParsableError Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/SocketParsableError" class="dashAnchor"></a>
|
||||
|
||||
<a title="SocketParsableError Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SocketParsableError Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketParsableError</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SocketParsableError</span> <span class="p">:</span> <span class="kt">Error</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Errors that can be thrown during parsing.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Cases"></a>
|
||||
<a name="//apple_ref/swift/Section/Cases" class="dashAnchor"></a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Cases"></a>
|
||||
<h3 class="section-name"><p>Cases</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A13ParsableErrorO16invalidDataArrayyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/invalidDataArray" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A13ParsableErrorO16invalidDataArrayyA2CmF">invalidDataArray</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Thrown when a packet received has an invalid data array, or is missing the data array.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">invalidDataArray</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A13ParsableErrorO13invalidPacketyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/invalidPacket" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A13ParsableErrorO13invalidPacketyA2CmF">invalidPacket</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Thrown when an malformed packet is received.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">invalidPacket</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A13ParsableErrorO17invalidPacketTypeyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/invalidPacketType" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A13ParsableErrorO17invalidPacketTypeyA2CmF">invalidPacketType</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Thrown when the parser receives an unknown packet type.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">invalidPacketType</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -0,0 +1,567 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Extensions Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="js/jquery.min.js" defer></script>
|
||||
<script src="js/jazzy.js" defer></script>
|
||||
|
||||
<script src="js/lunr.min.js" defer></script>
|
||||
<script src="js/typeahead.jquery.js" defer></script>
|
||||
<script src="js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Extensions" class="dashAnchor"></a>
|
||||
|
||||
<a title="Extensions Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Extensions Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Extensions</h1>
|
||||
<p>The following extensions are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:Sa"></a>
|
||||
<a name="//apple_ref/swift/Extension/Array" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:Sa">Array</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Array</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:Sb"></a>
|
||||
<a name="//apple_ref/swift/Extension/Bool" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:Sb">Bool</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Bool</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:SD"></a>
|
||||
<a name="//apple_ref/swift/Extension/Dictionary" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:SD">Dictionary</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Dictionary</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:Sd"></a>
|
||||
<a name="//apple_ref/swift/Extension/Double" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:Sd">Double</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Double</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:Si"></a>
|
||||
<a name="//apple_ref/swift/Extension/Int" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:Si">Int</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Int</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:objc(cs)NSArray"></a>
|
||||
<a name="//apple_ref/swift/Extension/NSArray" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:objc(cs)NSArray">NSArray</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">NSArray</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:10Foundation4DataV"></a>
|
||||
<a name="//apple_ref/swift/Extension/Data" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:10Foundation4DataV">Data</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Data</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:objc(cs)NSData"></a>
|
||||
<a name="//apple_ref/swift/Extension/NSData" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:objc(cs)NSData">NSData</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">NSData</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:objc(cs)NSDictionary"></a>
|
||||
<a name="//apple_ref/swift/Extension/NSDictionary" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">NSDictionary</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:objc(cs)NSString"></a>
|
||||
<a name="//apple_ref/swift/Extension/NSString" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:objc(cs)NSString">NSString</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">NSString</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:objc(cs)NSNull"></a>
|
||||
<a name="//apple_ref/swift/Extension/NSNull" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:objc(cs)NSNull">NSNull</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">NSNull</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:SS"></a>
|
||||
<a name="//apple_ref/swift/Extension/String" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:SS">String</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">String</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketData.html">SocketData</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Global Variables Reference</title>
|
||||
<title>Guides Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,15 +14,16 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Guides" class="dashAnchor"></a>
|
||||
|
||||
<a title="Global Variables Reference"></a>
|
||||
<a title="Guides Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -37,33 +38,38 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Global Variables Reference
|
||||
Guides Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -71,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -108,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -116,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -133,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -168,9 +228,9 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Global Variables</h1>
|
||||
<p>The following global variables are available globally.</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>Guides</h1>
|
||||
<p>The following guides are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -182,59 +242,29 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:v8SocketIO31WebsocketDidConnectNotificationSS"></a>
|
||||
<a name="//apple_ref/swift/Global/WebsocketDidConnectNotification" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
<a name="/documentation.15to16"></a>
|
||||
<a name="//apple_ref/swift/Guide/15to16" class="dashAnchor"></a>
|
||||
<a class="direct-link" href="15to16.html">15to16</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:v8SocketIO34WebsocketDidDisconnectNotificationSS"></a>
|
||||
<a name="//apple_ref/swift/Global/WebsocketDidDisconnectNotification" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
<a name="/documentation.FAQ"></a>
|
||||
<a name="//apple_ref/swift/Guide/FAQ" class="dashAnchor"></a>
|
||||
<a class="direct-link" href="faq.html">FAQ</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS"></a>
|
||||
<a name="//apple_ref/swift/Global/WebsocketDisconnectionErrorKeyName" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
<a name="/documentation.12to13"></a>
|
||||
<a name="//apple_ref/swift/Guide/12to13" class="dashAnchor"></a>
|
||||
<a class="direct-link" href="12to13.html">12to13</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -244,8 +274,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
+327
-198
@@ -14,15 +14,16 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Protocols" class="dashAnchor"></a>
|
||||
|
||||
<a title="Protocols Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -43,27 +44,32 @@
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -71,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -108,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -116,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -133,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -168,7 +228,7 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>Protocols</h1>
|
||||
<p>The following protocols are available globally.</p>
|
||||
|
||||
@@ -182,9 +242,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:P8SocketIO21SocketEngineWebsocket"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketEngineWebsocket" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:P8SocketIO21SocketEngineWebsocket">SocketEngineWebsocket</a>
|
||||
<a name="/s:8SocketIO14ConfigSettableP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/ConfigSettable" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO14ConfigSettableP">ConfigSettable</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -192,31 +252,84 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Protocol that is used to implement socket.io WebSocket support</p>
|
||||
<p>Declares that a type can set configs from a <code><a href="Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a></code>.</p>
|
||||
|
||||
<a href="Protocols/SocketEngineWebsocket.html" class="slightly-smaller">See more</a>
|
||||
<a href="Protocols/ConfigSettable.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketEngineWebsocket</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a></span><span class="p">,</span> <span class="kt"><a href="Protocols/WebSocketDelegate.html">WebSocketDelegate</a></span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ConfigSettable</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:P8SocketIO20SocketEnginePollable"></a>
|
||||
<a name="/s:8SocketIO0A12IOClientSpecP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketIOClientSpec" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A12IOClientSpecP">SocketIOClientSpec</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Defines the interface for a SocketIOClient.</p>
|
||||
|
||||
<a href="Protocols/SocketIOClientSpec.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketIOClientSpec</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/c:@M@SocketIO@objc(pl)SocketEngineClient"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketEngineClient" class="dashAnchor"></a>
|
||||
<a class="token" href="#/c:@M@SocketIO@objc(pl)SocketEngineClient">SocketEngineClient</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Declares that a type will be a delegate to an engine.</p>
|
||||
|
||||
<a href="Protocols/SocketEngineClient.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">@objc</span>
|
||||
<span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketEngineClient</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A14EnginePollableP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketEnginePollable" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:P8SocketIO20SocketEnginePollable">SocketEnginePollable</a>
|
||||
<a class="token" href="#/s:8SocketIO0A14EnginePollableP">SocketEnginePollable</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -232,23 +345,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketEnginePollable</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a></span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketEnginePollable</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:P8SocketIO16SocketEngineSpec"></a>
|
||||
<a name="/s:8SocketIO0A10EngineSpecP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketEngineSpec" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:P8SocketIO16SocketEngineSpec">SocketEngineSpec</a>
|
||||
<a class="token" href="#/s:8SocketIO0A10EngineSpecP">SocketEngineSpec</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -264,23 +373,175 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">@objc</span> <span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketEngineSpec</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketEngineSpec</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:P8SocketIO10SocketData"></a>
|
||||
<a name="/s:8SocketIO0A15EngineWebsocketP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketEngineWebsocket" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A15EngineWebsocketP">SocketEngineWebsocket</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Protocol that is used to implement socket.io WebSocket support</p>
|
||||
|
||||
<a href="Protocols/SocketEngineWebsocket.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketEngineWebsocket</span> <span class="p">:</span> <span class="kt"><a href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A11ManagerSpecP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketManagerSpec" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A11ManagerSpecP">SocketManagerSpec</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>A manager for a socket.io connection.</p>
|
||||
|
||||
<p>A <code>SocketManagerSpec</code> is responsible for multiplexing multiple namespaces through a single <code><a href="Protocols/SocketEngineSpec.html">SocketEngineSpec</a></code>.</p>
|
||||
|
||||
<p>Example with <code><a href="Classes/SocketManager.html">SocketManager</a></code>:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">manager</span> <span class="o">=</span> <span class="kt">SocketManager</span><span class="p">(</span><span class="nv">socketURL</span><span class="p">:</span> <span class="kt">URL</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span><span class="s">"http://localhost:8080/"</span><span class="p">)</span><span class="o">!</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">defaultNamespaceSocket</span> <span class="o">=</span> <span class="n">manager</span><span class="o">.</span><span class="n">defaultSocket</span>
|
||||
<span class="k">let</span> <span class="nv">swiftSocket</span> <span class="o">=</span> <span class="n">manager</span><span class="o">.</span><span class="nf">socket</span><span class="p">(</span><span class="nv">forNamespace</span><span class="p">:</span> <span class="s">"/swift"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1">// defaultNamespaceSocket and swiftSocket both share a single connection to the server</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Sockets created through the manager are retained by the manager. So at the very least, a single strong reference
|
||||
to the manager must be maintained to keep sockets alive.</p>
|
||||
|
||||
<p>To disconnect a socket and remove it from the manager, either call <code><a href="Classes/SocketIOClient.html#/s:8SocketIO0A8IOClientC10disconnectyyF">SocketIOClient.disconnect()</a></code> on the socket,
|
||||
or call one of the <code>disconnectSocket</code> methods on this class.</p>
|
||||
|
||||
<a href="Protocols/SocketManagerSpec.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketManagerSpec</span> <span class="p">:</span> <span class="kt">AnyObject</span><span class="p">,</span> <span class="kt"><a href="Protocols/SocketEngineClient.html">SocketEngineClient</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A8ParsableP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketParsable" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A8ParsableP">SocketParsable</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Defines that a type will be able to parse socket.io-protocol messages.</p>
|
||||
|
||||
<a href="Protocols/SocketParsable.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketParsable</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A14DataBufferableP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketDataBufferable" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14DataBufferableP">SocketDataBufferable</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Says that a type will be able to buffer binary data before all data for an event has come in.</p>
|
||||
|
||||
<a href="Protocols/SocketDataBufferable.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketDataBufferable</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A6LoggerP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketLogger" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A6LoggerP">SocketLogger</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents a class will log client events.</p>
|
||||
|
||||
<a href="Protocols/SocketLogger.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketLogger</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO0A4DataP"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketData" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:P8SocketIO10SocketData">SocketData</a>
|
||||
<a class="token" href="#/s:8SocketIO0A4DataP">SocketData</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -309,7 +570,7 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketData</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketData</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -318,146 +579,14 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:P8SocketIO12SocketLogger"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketLogger" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:P8SocketIO12SocketLogger">SocketLogger</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents a class will log client events.</p>
|
||||
|
||||
<a href="Protocols/SocketLogger.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketLogger</span> <span class="p">:</span> <span class="kd">class</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:P8SocketIO17WebSocketDelegate"></a>
|
||||
<a name="//apple_ref/swift/Protocol/WebSocketDelegate" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:P8SocketIO17WebSocketDelegate">WebSocketDelegate</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
<a href="Protocols/WebSocketDelegate.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:P8SocketIO21WebSocketPongDelegate"></a>
|
||||
<a name="//apple_ref/swift/Protocol/WebSocketPongDelegate" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:P8SocketIO21WebSocketPongDelegate">WebSocketPongDelegate</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
<a href="Protocols/WebSocketPongDelegate.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:P8SocketIO18SocketEngineClient"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketEngineClient" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:P8SocketIO18SocketEngineClient">SocketEngineClient</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Declares that a type will be a delegate to an engine.</p>
|
||||
|
||||
<a href="Protocols/SocketEngineClient.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">@objc</span> <span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketEngineClient</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:P8SocketIO17SSLTrustValidator"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SSLTrustValidator" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:P8SocketIO17SSLTrustValidator">SSLTrustValidator</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
<a href="Protocols/SSLTrustValidator.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,317 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>ConfigSettable Protocol Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Protocol/ConfigSettable" class="dashAnchor"></a>
|
||||
|
||||
<a title="ConfigSettable Protocol Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
ConfigSettable Protocol Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content top-matter">
|
||||
<h1>ConfigSettable</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ConfigSettable</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Declares that a type can set configs from a <code><a href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a></code>.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Methods"></a>
|
||||
<a name="//apple_ref/swift/Section/Methods" class="dashAnchor"></a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Methods"></a>
|
||||
<h3 class="section-name"><p>Methods</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:8SocketIO14ConfigSettableP10setConfigsyyAA0A21IOClientConfigurationVF"></a>
|
||||
<a name="//apple_ref/swift/Method/setConfigs(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO14ConfigSettableP10setConfigsyyAA0A21IOClientConfigurationVF">setConfigs(_:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Called when an <code>ConfigSettable</code> should set/update its configs from a given configuration.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">mutating</span> <span class="kd">func</span> <span class="nf">setConfigs</span><span class="p">(</span><span class="n">_</span> <span class="nv">config</span><span class="p">:</span> <span class="kt"><a href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a></span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>config</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The <code><a href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a></code> that should be used to set/update configs.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,215 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SSLTrustValidator Protocol Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Protocol/SSLTrustValidator" class="dashAnchor"></a>
|
||||
|
||||
<a title="SSLTrustValidator Protocol Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SSLTrustValidator Protocol Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketClientEvent.html">SocketClientEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketEnginePacketType.html">SocketEnginePacketType</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEnginePollable.html">SocketEnginePollable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineSpec.html">SocketEngineSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>SSLTrustValidator</h1>
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FP8SocketIO17SSLTrustValidator7isValidFTCSo8SecTrust6domainGSqSS__Sb"></a>
|
||||
<a name="//apple_ref/swift/Method/isValid(_:domain:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FP8SocketIO17SSLTrustValidator7isValidFTCSo8SecTrust6domainGSqSS__Sb">isValid(_:domain:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
+108
-46
@@ -21,9 +21,9 @@
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -44,27 +44,32 @@
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,11 +228,12 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketData</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketData</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketData</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -201,17 +261,19 @@
|
||||
<div class="task-name-container">
|
||||
<a name="/Methods"></a>
|
||||
<a name="//apple_ref/swift/Section/Methods" class="dashAnchor"></a>
|
||||
<a href="#/Methods">
|
||||
<h3 class="section-name">Methods</h3>
|
||||
</a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Methods"></a>
|
||||
<h3 class="section-name"><p>Methods</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FP8SocketIO10SocketData20socketRepresentationFzT_PS0__"></a>
|
||||
<a name="/s:8SocketIO0A4DataP20socketRepresentationAaB_pyKF"></a>
|
||||
<a name="//apple_ref/swift/Method/socketRepresentation()" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FP8SocketIO10SocketData20socketRepresentationFzT_PS0__">socketRepresentation()</a>
|
||||
<a class="token" href="#/s:8SocketIO0A4DataP20socketRepresentationAaB_pyKF">socketRepresentation()</a>
|
||||
</code>
|
||||
<span class="declaration-note">
|
||||
Default implementation
|
||||
@@ -234,7 +296,7 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">func</span> <span class="nf">socketRepresentation</span><span class="p">()</span> <span class="k">throws</span> <span class="o">-></span> <span class="kt">SocketData</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">socketRepresentation</span><span class="p">()</span> <span class="k">throws</span> <span class="o">-></span> <span class="kt">SocketData</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -249,8 +311,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
+135
-104
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>WebSocketDelegate Protocol Reference</title>
|
||||
<title>SocketDataBufferable Protocol Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,16 +14,16 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Protocol/WebSocketDelegate" class="dashAnchor"></a>
|
||||
<a name="//apple_ref/swift/Protocol/SocketDataBufferable" class="dashAnchor"></a>
|
||||
|
||||
<a title="WebSocketDelegate Protocol Reference"></a>
|
||||
<a title="SocketDataBufferable Protocol Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SocketIO Docs
|
||||
SocketIO 16.0.0 Docs
|
||||
</a>
|
||||
(84% documented)
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -38,33 +38,38 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SocketIO Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
WebSocketDelegate Protocol Reference
|
||||
SocketDataBufferable Protocol Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Guides.html">Guides</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../12to13.html">12to13</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../15to16.html">15to16</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../faq.html">FAQ</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/OnAckCallback.html">OnAckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLCert.html">SSLCert</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SSLSecurity.html">SSLSecurity</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAckEmitter.html">SocketAckEmitter</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketAnyEvent.html">SocketAnyEvent</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketClientManager.html">SocketClientManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketEngine.html">SocketEngine</a>
|
||||
</li>
|
||||
@@ -72,29 +77,18 @@
|
||||
<a class="nav-group-task-link" href="../Classes/SocketIOClient.html">SocketIOClient</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket.html">WebSocket</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketManager.html">SocketManager</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/WebSocket/CloseCode.html">– CloseCode</a>
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawAckView.html">SocketRawAckView</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Classes/SocketRawView.html">SocketRawView</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Global Variables.html">Global Variables</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO31WebsocketDidConnectNotificationSS">WebsocketDidConnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDidDisconnectNotificationSS">WebsocketDidDisconnectNotification</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Global Variables.html#/s:v8SocketIO34WebsocketDisconnectionErrorKeyNameSS">WebsocketDisconnectionErrorKeyName</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketAckStatus.html">SocketAckStatus</a>
|
||||
@@ -109,7 +103,54 @@
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientOption.html">SocketIOClientOption</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOClientStatus.html">SocketIOClientStatus</a>
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOStatus.html">SocketIOStatus</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketIOVersion.html">SocketIOVersion</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SocketParsableError.html">SocketParsableError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sa">Array</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sb">Bool</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:10Foundation4DataV">Data</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SD">Dictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Sd">Double</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:Si">Int</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSArray">NSArray</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSData">NSData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSDictionary">NSDictionary</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSNull">NSNull</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/c:objc(cs)NSString">NSString</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Extensions.html#/s:SS">String</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -117,11 +158,14 @@
|
||||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SSLTrustValidator.html">SSLTrustValidator</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/ConfigSettable.html">ConfigSettable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketData.html">SocketData</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketDataBufferable.html">SocketDataBufferable</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineClient.html">SocketEngineClient</a>
|
||||
</li>
|
||||
@@ -134,33 +178,48 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketEngineWebsocket.html">SocketEngineWebsocket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketIOClientSpec.html">SocketIOClientSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketLogger.html">SocketLogger</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketDelegate.html">WebSocketDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketManagerSpec.html">SocketManagerSpec</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Protocols/WebSocketPongDelegate.html">WebSocketPongDelegate</a>
|
||||
<a class="nav-group-task-link" href="../Protocols/SocketParsable.html">SocketParsable</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketEventHandler.html">SocketEventHandler</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketIOClientConfiguration.html">SocketIOClientConfiguration</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket.html">SocketPacket</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SocketPacket/PacketType.html">– PacketType</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallback">AckCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO11AckCallbacka">AckCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallback">NormalCallback</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO14NormalCallbacka">NormalCallback</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:8SocketIO4Posta">Post</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -169,9 +228,16 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>WebSocketDelegate</h1>
|
||||
<p>Undocumented</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>SocketDataBufferable</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SocketDataBufferable</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Says that a type will be able to buffer binary data before all data for an event has come in.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -179,13 +245,22 @@
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<div class="task-name-container">
|
||||
<a name="/Properties"></a>
|
||||
<a name="//apple_ref/swift/Section/Properties" class="dashAnchor"></a>
|
||||
<div class="section-name-container">
|
||||
<a class="section-name-link" href="#/Properties"></a>
|
||||
<h3 class="section-name"><p>Properties</p>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FP8SocketIO17WebSocketDelegate19websocketDidConnectFT6socketCS_9WebSocket_T_"></a>
|
||||
<a name="//apple_ref/swift/Method/websocketDidConnect(socket:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FP8SocketIO17WebSocketDelegate19websocketDidConnectFT6socketCS_9WebSocket_T_">websocketDidConnect(socket:)</a>
|
||||
<a name="/s:8SocketIO0A14DataBufferableP14waitingPacketsSayAA0A6PacketVGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/waitingPackets" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:8SocketIO0A14DataBufferableP14waitingPacketsSayAA0A6PacketVGvp">waitingPackets</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -193,65 +268,21 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
<p>A list of packets that are waiting for binary data.</p>
|
||||
|
||||
<p>The way that socket.io works all data should be sent directly after each packet.
|
||||
So this should ideally be an array of one packet waiting for data.</p>
|
||||
|
||||
<p><strong>This should not be modified directly.</strong></p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FP8SocketIO17WebSocketDelegate22websocketDidDisconnectFT6socketCS_9WebSocket5errorGSqCSo7NSError__T_"></a>
|
||||
<a name="//apple_ref/swift/Method/websocketDidDisconnect(socket:error:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FP8SocketIO17WebSocketDelegate22websocketDidDisconnectFT6socketCS_9WebSocket5errorGSqCSo7NSError__T_">websocketDidDisconnect(socket:error:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FP8SocketIO17WebSocketDelegate26websocketDidReceiveMessageFT6socketCS_9WebSocket4textSS_T_"></a>
|
||||
<a name="//apple_ref/swift/Method/websocketDidReceiveMessage(socket:text:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FP8SocketIO17WebSocketDelegate26websocketDidReceiveMessageFT6socketCS_9WebSocket4textSS_T_">websocketDidReceiveMessage(socket:text:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FP8SocketIO17WebSocketDelegate23websocketDidReceiveDataFT6socketCS_9WebSocket4dataV10Foundation4Data_T_"></a>
|
||||
<a name="//apple_ref/swift/Method/websocketDidReceiveData(socket:data:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FP8SocketIO17WebSocketDelegate23websocketDidReceiveDataFT6socketCS_9WebSocket4dataV10Foundation4Data_T_">websocketDidReceiveData(socket:data:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">waitingPackets</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/SocketPacket.html">SocketPacket</a></span><span class="p">]</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
@@ -264,8 +295,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2017-05-27)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/socketio/socket.io-client-swift" target="_blank" rel="external">Erik</a>. All rights reserved. (Last updated: 2021-02-01)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
Loaded 100 of 125 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user