Compare commits
28
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b71348a074 | ||
|
|
db9671e2df | ||
|
|
2e7183b8de | ||
|
|
30e4f59a16 | ||
|
|
17bec21ad1 | ||
|
|
d9559e7c59 | ||
|
|
77dfd78904 | ||
|
|
033a509541 | ||
|
|
df3d7ae536 | ||
|
|
36cce4f969 | ||
|
|
4666c24d59 | ||
|
|
468d7b2453 | ||
|
|
6ca554f4ad | ||
|
|
7cf4d527df | ||
|
|
da5b019b33 | ||
|
|
bb61b70417 | ||
|
|
43d5455e82 | ||
|
|
e6964b56d0 | ||
|
|
88218e097d | ||
|
|
46a129072f | ||
|
|
4abd2ab671 | ||
|
|
87ecee13e6 | ||
|
|
f2ab06f732 | ||
|
|
62eeba69e8 | ||
|
|
7d8eb6ffc7 | ||
|
|
dd2167a09f | ||
|
|
8e25c6c417 | ||
|
|
8d16a8312d |
No files matched your search
@@ -51,7 +51,7 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{
|
||||
```
|
||||
|
||||
## Features
|
||||
- Supports socket.io 1.0+
|
||||
- Supports socket.io 2.0+ (For socket.io 1.0 use v9.x)
|
||||
- Supports binary
|
||||
- Supports Polling and WebSockets
|
||||
- Supports TLS/SSL
|
||||
@@ -92,7 +92,7 @@ Then import `import SocketIO`.
|
||||
### Carthage
|
||||
Add this line to your `Cartfile`:
|
||||
```
|
||||
github "socketio/socket.io-client-swift" ~> 9.0.0 # Or latest version
|
||||
github "socketio/socket.io-client-swift" ~> 10.0.0 # Or latest version
|
||||
```
|
||||
|
||||
Run `carthage update --platform ios,macosx`.
|
||||
@@ -104,7 +104,7 @@ Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
|
||||
use_frameworks!
|
||||
|
||||
target 'YourApp' do
|
||||
pod 'Socket.IO-Client-Swift', '~> 9.0.0' # Or latest version
|
||||
pod 'Socket.IO-Client-Swift', '~> 10.0.0' # Or latest version
|
||||
end
|
||||
```
|
||||
|
||||
@@ -132,7 +132,7 @@ Objective-C:
|
||||
Add this line to your `Seedfile`:
|
||||
|
||||
```
|
||||
github "socketio/socket.io-client-swift", "v9.0.0", :files => "Source/*.swift" # Or latest version
|
||||
github "socketio/socket.io-client-swift", "v10.0.0", :files => "Source/*.swift" # Or latest version
|
||||
```
|
||||
|
||||
Run `seed install`.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Socket.IO-Client-Swift"
|
||||
s.module_name = "SocketIO"
|
||||
s.version = "9.0.0"
|
||||
s.version = "10.0.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 1.0+ and Swift.
|
||||
For socket.io 2.0+ and Swift.
|
||||
DESC
|
||||
s.homepage = "https://github.com/socketio/socket.io-client-swift"
|
||||
s.license = { :type => 'MIT' }
|
||||
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
|
||||
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 => 'v9.0.0' }
|
||||
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v10.0.0' }
|
||||
s.source_files = "Source/**/*.swift"
|
||||
s.requires_arc = true
|
||||
s.pod_target_xcconfig = {'SWIFT_VERSION' => '3.1'}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
var assert = require("assert")
|
||||
|
||||
module.exports = {
|
||||
basicTest: {
|
||||
assert: function(inputData) {
|
||||
|
||||
},
|
||||
returnData: []
|
||||
},
|
||||
testNull: {
|
||||
assert: function(inputData) {
|
||||
assert(!inputData)
|
||||
},
|
||||
returnData: [null]
|
||||
},
|
||||
testBinary: {
|
||||
assert: function(inputData) {
|
||||
assert.equal(inputData.toString(), "gakgakgak2")
|
||||
},
|
||||
returnData: [new Buffer("gakgakgak2", "utf-8")]
|
||||
},
|
||||
testArray: {
|
||||
assert: function(inputData) {
|
||||
assert.equal(inputData.length, 2)
|
||||
assert.equal(inputData[0], "test1")
|
||||
assert.equal(inputData[1], "test2")
|
||||
},
|
||||
returnData: [["test3", "test4"]]
|
||||
},
|
||||
testString: {
|
||||
assert: function(inputData) {
|
||||
assert.equal(inputData, "marco")
|
||||
},
|
||||
returnData: ["polo"]
|
||||
},
|
||||
testBool: {
|
||||
assert: function(inputData) {
|
||||
assert(!inputData)
|
||||
},
|
||||
returnData: [true]
|
||||
},
|
||||
testInteger: {
|
||||
assert: function(inputData) {
|
||||
assert.equal(inputData, 10)
|
||||
},
|
||||
returnData: [20]
|
||||
},
|
||||
testDouble: {
|
||||
assert: function(inputData) {
|
||||
assert.equal(inputData, 1.1)
|
||||
},
|
||||
returnData: [1.2]
|
||||
},
|
||||
testJSON: {
|
||||
assert: function(inputData) {
|
||||
assert.equal(inputData.name, "test")
|
||||
assert.equal(inputData.nestedTest.test, "test")
|
||||
assert.equal(inputData.testArray.length, 1)
|
||||
},
|
||||
returnData: [{testString: "test", testNumber: 15, nestedTest: {test: "test"}, testArray: [1, 1]}]
|
||||
},
|
||||
testJSONWithBuffer: {
|
||||
assert: function(inputData) {
|
||||
assert.equal(inputData.name, "test")
|
||||
assert.equal(inputData.nestedTest.test, "test")
|
||||
assert.equal(inputData.testArray.length, 1)
|
||||
},
|
||||
returnData: [{testString: "test", testNumber: 15, nestedTest: {test: "test"}, testArray: [new Buffer("gakgakgak2", "utf-8"), 1]}]
|
||||
},testUnicode: {
|
||||
assert: function(inputData) {
|
||||
assert.equal(inputData, "🚀")
|
||||
},
|
||||
returnData: ["🚄"]
|
||||
},testMultipleItems: {
|
||||
assert: function(array, object, number, string, bool) {
|
||||
assert.equal(array.length, 2)
|
||||
assert.equal(array[0], "test1")
|
||||
assert.equal(array[1], "test2")
|
||||
assert.equal(number, 15)
|
||||
assert.equal(string, "marco")
|
||||
assert.equal(bool, false)
|
||||
},
|
||||
returnData: [[1, 2], {test: "bob"}, 25, "polo", false]
|
||||
},testMultipleItemsWithBuffer: {
|
||||
assert: function(array, object, number, string, binary) {
|
||||
assert.equal(array.length, 2)
|
||||
assert.equal(array[0], "test1")
|
||||
assert.equal(array[1], "test2")
|
||||
assert.equal(number, 15)
|
||||
assert.equal(string, "marco")
|
||||
assert.equal(binary.toString(), "gakgakgak2")
|
||||
},
|
||||
returnData: [[1, 2], {test: "bob"}, 25, "polo", new Buffer("gakgakgak2")]
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
function socketCallback(testKey, socket, testCase) {
|
||||
return function() {
|
||||
testCase.assert.apply(undefined , arguments)
|
||||
var emitArguments = testCase.returnData;
|
||||
var ack = arguments[arguments.length - 1]
|
||||
ack.apply(socket, emitArguments)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.socketCallback = socketCallback
|
||||
@@ -1,20 +0,0 @@
|
||||
function socketCallback(testKey, socket, testCase) {
|
||||
return function() {
|
||||
testCase.assert.apply(undefined , arguments)
|
||||
|
||||
var emitArguments = addArrays([testKey + "EmitReturn"], testCase.returnData)
|
||||
socket.emit.apply(socket, emitArguments)
|
||||
}
|
||||
}
|
||||
|
||||
function addArrays(firstArray, secondArray) {
|
||||
var length = secondArray.length
|
||||
var i;
|
||||
for(i = 0; i < length; i++) {
|
||||
firstArray.push(secondArray[i])
|
||||
}
|
||||
|
||||
return firstArray;
|
||||
}
|
||||
|
||||
module.exports.socketCallback = socketCallback
|
||||
@@ -1,15 +0,0 @@
|
||||
var app = require('http').createServer()
|
||||
var io = require('socket.io')(app);
|
||||
app.listen(6979)
|
||||
|
||||
|
||||
var acknowledgementsEvents = require("./acknowledgementEvents.js")
|
||||
var emitEvents = require("./emitEvents.js")
|
||||
var socketEventRegister = require("./socketEventRegister.js")
|
||||
|
||||
socketEventRegister.register(io, emitEvents.socketCallback, "Emit")
|
||||
socketEventRegister.register(io, acknowledgementsEvents.socketCallback, "Acknowledgement")
|
||||
|
||||
var nsp = io.of("/swift")
|
||||
socketEventRegister.register(nsp, emitEvents.socketCallback, "Emit")
|
||||
socketEventRegister.register(nsp, acknowledgementsEvents.socketCallback, "Acknowledgement")
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "socket.io-client-swift-test-server",
|
||||
"version": "0.0.1",
|
||||
"description": "A simple server to test aginst",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Lukas Schmidt",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"socket.io": "^1.3.6"
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
var testCases = require("./TestCases.js")
|
||||
|
||||
function registerSocketForEvents(ioSocket, socketCallback, testKind) {
|
||||
ioSocket.on('connection', function(socket) {
|
||||
var testCase;
|
||||
for(testKey in testCases) {
|
||||
testCase = testCases[testKey]
|
||||
socket.on((testKey + testKind), socketCallback(testKey, socket, testCase))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports.register = registerSocketForEvents
|
||||
@@ -17,28 +17,28 @@ class SocketEngineTest: XCTestCase {
|
||||
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" {
|
||||
@@ -46,44 +46,46 @@ class SocketEngineTest: XCTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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\"}", fromPolling: false)
|
||||
|
||||
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", fromPolling: false)
|
||||
|
||||
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")
|
||||
XCTAssertEqual(data[0] as? String, "lïne one\nlīne \rtwo𦅙𦅛", "Failed string test")
|
||||
expect.fulfill()
|
||||
}
|
||||
|
||||
engine.parsePollingMessage("41:42[\"stringTest\",\"lïne one\\nlīne \\rtwo\"]")
|
||||
let stringMessage = "42[\"stringTest\",\"lïne one\\nlīne \\rtwo𦅙𦅛\"]"
|
||||
|
||||
engine.parsePollingMessage("\(stringMessage.utf16.count):\(stringMessage)")
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
|
||||
@@ -102,23 +104,23 @@ class SocketEngineTest: XCTestCase {
|
||||
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, fromPolling: false)
|
||||
engine.parseEngineMessage(b64String, fromPolling: false)
|
||||
|
||||
|
||||
engine.parseEngineMessage(packetString)
|
||||
engine.parseEngineMessage(b64String)
|
||||
|
||||
waitForExpectations(timeout: 3, handler: nil)
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,9 @@
|
||||
// Merely tests whether the Objective-C api breaks
|
||||
//
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
@import Dispatch;
|
||||
@import Foundation;
|
||||
@import XCTest;
|
||||
@import SocketIO;
|
||||
|
||||
@interface SocketObjectiveCTest : XCTestCase
|
||||
@@ -24,20 +26,66 @@
|
||||
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) {
|
||||
|
||||
}];
|
||||
[[self.socket emitWithAck:@"testAckEmit" with:@[@YES]] timingOutAfter:0 callback:^(NSArray* data) { }];
|
||||
}
|
||||
|
||||
- (void)testOffSyntax {
|
||||
|
||||
@@ -221,6 +221,81 @@ class SocketSideEffectTest: XCTestCase {
|
||||
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!
|
||||
@@ -231,3 +306,14 @@ class SocketSideEffectTest: XCTestCase {
|
||||
socket.setTestable()
|
||||
}
|
||||
}
|
||||
|
||||
struct ThrowingData : SocketData {
|
||||
enum ThrowingError : Error {
|
||||
case error
|
||||
}
|
||||
|
||||
func socketRepresentation() throws -> SocketData {
|
||||
throw ThrowingError.error
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,11 +48,18 @@ public final class SocketAckEmitter : NSObject {
|
||||
|
||||
/// 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 }
|
||||
|
||||
socket.emitAck(ackNum, with: items)
|
||||
do {
|
||||
socket.emitAck(ackNum, with: try items.map({ try $0.socketRepresentation() }))
|
||||
} catch let err {
|
||||
socket.handleClientEvent(.error, data: [ackNum, items, err])
|
||||
}
|
||||
}
|
||||
|
||||
/// Call to ack receiving this event.
|
||||
@@ -98,7 +105,7 @@ public final class OnAckCallback : NSObject {
|
||||
/// - 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) {
|
||||
guard let socket = self.socket else { return }
|
||||
guard let socket = self.socket, ackNumber != -1 else { return }
|
||||
|
||||
socket.ackHandlers.addAck(ackNumber, callback: callback)
|
||||
socket._emit(items, ack: ackNumber)
|
||||
|
||||
+19
-30
@@ -66,10 +66,6 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
/// An array of HTTPCookies that are sent during the connection.
|
||||
public private(set) var cookies: [HTTPCookie]?
|
||||
|
||||
/// Set to `true` if using the node.js version of socket.io. The node.js version of socket.io
|
||||
/// handles utf8 incorrectly.
|
||||
public private(set) var doubleEncodeUTF8 = true
|
||||
|
||||
/// A dictionary of extra http headers that will be set during connection.
|
||||
public private(set) var extraHeaders: [String: String]?
|
||||
|
||||
@@ -153,8 +149,6 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
connectParams = params
|
||||
case let .cookies(cookies):
|
||||
self.cookies = cookies
|
||||
case let .doubleEncodeUTF8(encode):
|
||||
doubleEncodeUTF8 = encode
|
||||
case let .extraHeaders(headers):
|
||||
extraHeaders = headers
|
||||
case let .sessionDelegate(delegate):
|
||||
@@ -227,8 +221,8 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
// binary in base64 string
|
||||
let noPrefix = message[message.index(message.startIndex, offsetBy: 2)..<message.endIndex]
|
||||
|
||||
if let data = NSData(base64Encoded: noPrefix, options: .ignoreUnknownCharacters) {
|
||||
client?.parseEngineBinaryData(data as Data)
|
||||
if let data = Data(base64Encoded: noPrefix, options: .ignoreUnknownCharacters) {
|
||||
client?.parseEngineBinaryData(data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,11 +505,10 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
/// - 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, fromPolling: Bool) {
|
||||
public func parseEngineMessage(_ message: String) {
|
||||
DefaultSocketLogger.Logger.log("Got message: %@", type: logType, args: message)
|
||||
|
||||
let reader = SocketStringReader(message: message)
|
||||
let fixedString: String
|
||||
|
||||
if message.hasPrefix("b4") {
|
||||
return handleBase64(message: message)
|
||||
@@ -527,23 +520,17 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
return
|
||||
}
|
||||
|
||||
if fromPolling && type != .noop && doubleEncodeUTF8 {
|
||||
fixedString = fixDoubleUTF8(message)
|
||||
} else {
|
||||
fixedString = message
|
||||
}
|
||||
|
||||
switch type {
|
||||
case .message:
|
||||
handleMessage(String(fixedString.characters.dropFirst()))
|
||||
handleMessage(String(message.characters.dropFirst()))
|
||||
case .noop:
|
||||
handleNOOP()
|
||||
case .pong:
|
||||
handlePong(with: fixedString)
|
||||
handlePong(with: message)
|
||||
case .open:
|
||||
handleOpen(openData: String(fixedString.characters.dropFirst()))
|
||||
handleOpen(openData: String(message.characters.dropFirst()))
|
||||
case .close:
|
||||
handleClose(fixedString)
|
||||
handleClose(message)
|
||||
default:
|
||||
DefaultSocketLogger.Logger.log("Got unknown packet type", type: logType)
|
||||
}
|
||||
@@ -643,17 +630,19 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
||||
return
|
||||
}
|
||||
|
||||
if websocket {
|
||||
connected = false
|
||||
websocket = false
|
||||
|
||||
if let reason = error?.localizedDescription {
|
||||
didError(reason: reason)
|
||||
} else {
|
||||
client?.engineDidClose(reason: "Socket Disconnected")
|
||||
}
|
||||
} else {
|
||||
guard websocket else {
|
||||
flushProbeWait()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
connected = false
|
||||
websocket = false
|
||||
|
||||
if let reason = error?.localizedDescription {
|
||||
didError(reason: reason)
|
||||
} else {
|
||||
client?.engineDidClose(reason: "Socket Disconnected")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +71,7 @@ public protocol SocketEnginePollable : SocketEngineSpec {
|
||||
|
||||
// Default polling methods
|
||||
extension SocketEnginePollable {
|
||||
private func addHeaders(for req: URLRequest) -> URLRequest {
|
||||
var req = req
|
||||
|
||||
private func addHeaders(to req: inout URLRequest) {
|
||||
if cookies != nil {
|
||||
let headers = HTTPCookie.requestHeaderFields(with: cookies!)
|
||||
req.allHTTPHeaderFields = headers
|
||||
@@ -84,8 +82,6 @@ extension SocketEnginePollable {
|
||||
req.setValue(value, forHTTPHeaderField: headerName)
|
||||
}
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
func createRequestForPostWithPostWait() -> URLRequest {
|
||||
@@ -94,9 +90,7 @@ extension SocketEnginePollable {
|
||||
var postStr = ""
|
||||
|
||||
for packet in postWait {
|
||||
let len = packet.characters.count
|
||||
|
||||
postStr += "\(len):\(packet)"
|
||||
postStr += "\(packet.utf16.count):\(packet)"
|
||||
}
|
||||
|
||||
DefaultSocketLogger.Logger.log("Created POST string: %@", type: "SocketEnginePolling", args: postStr)
|
||||
@@ -104,11 +98,10 @@ extension SocketEnginePollable {
|
||||
var req = URLRequest(url: urlPollingWithSid)
|
||||
let postData = postStr.data(using: .utf8, allowLossyConversion: false)!
|
||||
|
||||
req = addHeaders(for: req)
|
||||
addHeaders(to: &req)
|
||||
|
||||
req.httpMethod = "POST"
|
||||
req.setValue("text/plain; charset=UTF-8", forHTTPHeaderField: "Content-Type")
|
||||
|
||||
req.httpBody = postData
|
||||
req.setValue(String(postData.count), forHTTPHeaderField: "Content-Length")
|
||||
|
||||
@@ -119,20 +112,16 @@ extension SocketEnginePollable {
|
||||
///
|
||||
/// You shouldn't need to call this directly, the engine should automatically maintain a long-poll request.
|
||||
public func doPoll() {
|
||||
if websocket || waitingForPoll || !connected || closed {
|
||||
return
|
||||
}
|
||||
guard !websocket && !waitingForPoll && connected && !closed else { return }
|
||||
|
||||
var req = URLRequest(url: urlPollingWithSid)
|
||||
req = addHeaders(for: req)
|
||||
addHeaders(to: &req)
|
||||
|
||||
doLongPoll(for: req )
|
||||
doLongPoll(for: req)
|
||||
}
|
||||
|
||||
func doRequest(for req: URLRequest, callbackWith callback: @escaping (Data?, URLResponse?, Error?) -> Void) {
|
||||
if !polling || closed || invalidated || fastUpgrade {
|
||||
return
|
||||
}
|
||||
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)
|
||||
@@ -158,7 +147,7 @@ extension SocketEnginePollable {
|
||||
|
||||
DefaultSocketLogger.Logger.log("Got polling response", type: "SocketEnginePolling")
|
||||
|
||||
if let str = String(data: data!, encoding: String.Encoding.utf8) {
|
||||
if let str = String(data: data!, encoding: .utf8) {
|
||||
this.parsePollingMessage(str)
|
||||
}
|
||||
|
||||
@@ -173,10 +162,10 @@ extension SocketEnginePollable {
|
||||
}
|
||||
|
||||
private func flushWaitingForPost() {
|
||||
if postWait.count == 0 || !connected {
|
||||
return
|
||||
} else if websocket {
|
||||
guard postWait.count != 0 && connected else { return }
|
||||
guard !websocket else {
|
||||
flushWaitingForPostToWebSocket()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -211,13 +200,15 @@ extension SocketEnginePollable {
|
||||
func parsePollingMessage(_ str: String) {
|
||||
guard str.characters.count != 1 else { return }
|
||||
|
||||
DefaultSocketLogger.Logger.log("Got poll message: %@", type: "SocketEnginePolling", args: str)
|
||||
|
||||
var reader = SocketStringReader(message: str)
|
||||
|
||||
while reader.hasNext {
|
||||
if let n = Int(reader.readUntilOccurence(of: ":")) {
|
||||
parseEngineMessage(reader.read(count: n), fromPolling: true)
|
||||
parseEngineMessage(reader.read(count: n))
|
||||
} else {
|
||||
parseEngineMessage(str, fromPolling: true)
|
||||
parseEngineMessage(str)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -232,15 +223,8 @@ extension SocketEnginePollable {
|
||||
/// - 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)
|
||||
let fixedMessage: String
|
||||
|
||||
if doubleEncodeUTF8 {
|
||||
fixedMessage = doubleEncodeUTF8(message)
|
||||
} else {
|
||||
fixedMessage = message
|
||||
}
|
||||
|
||||
postWait.append(String(type.rawValue) + fixedMessage)
|
||||
postWait.append(String(type.rawValue) + message)
|
||||
|
||||
for data in datas {
|
||||
if case let .right(bin) = createBinaryDataForSend(using: data) {
|
||||
|
||||
@@ -39,10 +39,6 @@ import Foundation
|
||||
/// The connect parameters sent during a connect.
|
||||
var connectParams: [String: Any]? { get set }
|
||||
|
||||
/// Set to `true` if using the node.js version of socket.io. The node.js version of socket.io
|
||||
/// handles utf8 incorrectly.
|
||||
var doubleEncodeUTF8: Bool { get }
|
||||
|
||||
/// An array of HTTPCookies that are sent during the connection.
|
||||
var cookies: [HTTPCookie]? { get }
|
||||
|
||||
@@ -125,7 +121,7 @@ import Foundation
|
||||
/// - 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, fromPolling: Bool)
|
||||
func parseEngineMessage(_ message: String)
|
||||
|
||||
/// Writes a message to engine.io, independent of transport.
|
||||
///
|
||||
@@ -159,27 +155,7 @@ extension SocketEngineSpec {
|
||||
|
||||
return .left(mutData as Data)
|
||||
} else {
|
||||
let str = "b4" + data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0))
|
||||
|
||||
return .right(str)
|
||||
}
|
||||
}
|
||||
|
||||
func doubleEncodeUTF8(_ string: String) -> String {
|
||||
if let latin1 = string.data(using: String.Encoding.utf8),
|
||||
let utf8 = NSString(data: latin1, encoding: String.Encoding.isoLatin1.rawValue) {
|
||||
return utf8 as String
|
||||
} else {
|
||||
return string
|
||||
}
|
||||
}
|
||||
|
||||
func fixDoubleUTF8(_ string: String) -> String {
|
||||
if let utf8 = string.data(using: String.Encoding.isoLatin1),
|
||||
let latin1 = NSString(data: utf8, encoding: String.Encoding.utf8.rawValue) {
|
||||
return latin1 as String
|
||||
} else {
|
||||
return string
|
||||
return .right("b4" + data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ extension SocketEngineWebsocket {
|
||||
|
||||
/// Delegate method for when a message is received.
|
||||
public func websocketDidReceiveMessage(socket: WebSocket, text: String) {
|
||||
parseEngineMessage(text, fromPolling: false)
|
||||
parseEngineMessage(text)
|
||||
}
|
||||
|
||||
/// Delegate method for when binary is received.
|
||||
|
||||
@@ -48,8 +48,6 @@ extension NSDictionary {
|
||||
return .connectParams(params)
|
||||
case let ("cookies", cookies as [HTTPCookie]):
|
||||
return .cookies(cookies)
|
||||
case let ("doubleEncodeUTF8", encode as Bool):
|
||||
return .doubleEncodeUTF8(encode)
|
||||
case let ("extraHeaders", headers as [String: String]):
|
||||
return .extraHeaders(headers)
|
||||
case let ("forceNew", force as Bool):
|
||||
@@ -88,39 +86,39 @@ extension NSDictionary {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func toSocketConfiguration() -> SocketIOClientConfiguration {
|
||||
var options = [] as SocketIOClientConfiguration
|
||||
|
||||
|
||||
for (rawKey, value) in self {
|
||||
if let key = rawKey as? String, let opt = NSDictionary.keyValueToSocketIOClientOption(key: key, value: value) {
|
||||
options.insert(opt)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return options
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
func toArray() throws -> [Any] {
|
||||
guard let stringData = data(using: .utf8, allowLossyConversion: false) else { return [] }
|
||||
guard let stringData = data(using: .utf16, allowLossyConversion: false) else { return [] }
|
||||
guard let array = try JSONSerialization.jsonObject(with: stringData, options: .mutableContainers) as? [Any] else {
|
||||
throw JSONError.notArray
|
||||
}
|
||||
|
||||
|
||||
return array
|
||||
}
|
||||
|
||||
|
||||
func toNSDictionary() throws -> NSDictionary {
|
||||
guard let binData = data(using: .utf8, allowLossyConversion: false) else { return [:] }
|
||||
guard let binData = data(using: .utf16, allowLossyConversion: false) else { return [:] }
|
||||
guard let json = try JSONSerialization.jsonObject(with: binData, options: .allowFragments) as? NSDictionary else {
|
||||
throw JSONError.notNSDictionary
|
||||
}
|
||||
|
||||
|
||||
return json
|
||||
}
|
||||
|
||||
|
||||
func urlEncode() -> String? {
|
||||
return addingPercentEncoding(withAllowedCharacters: .allowedURLCharacterSet)
|
||||
}
|
||||
|
||||
+45
-31
@@ -27,13 +27,12 @@ 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 URL of the socket.io server. This is set in the initializer.
|
||||
public let socketURL: URL
|
||||
|
||||
/// The engine for this client.
|
||||
public private(set) var engine: SocketEngineSpec?
|
||||
|
||||
@@ -76,18 +75,24 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
return engine?.sid
|
||||
}
|
||||
|
||||
private let logType = "SocketIOClient"
|
||||
/// 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
|
||||
|
||||
private var anyHandler: ((SocketAnyEvent) -> Void)?
|
||||
private var currentReconnectAttempt = 0
|
||||
private var handlers = [SocketEventHandler]()
|
||||
private var reconnecting = false
|
||||
var ackHandlers = SocketAckManager()
|
||||
var waitingPackets = [SocketPacket]()
|
||||
|
||||
private(set) var currentAck = -1
|
||||
private(set) var reconnectAttempts = -1
|
||||
|
||||
var ackHandlers = SocketAckManager()
|
||||
var waitingPackets = [SocketPacket]()
|
||||
private let logType = "SocketIOClient"
|
||||
|
||||
private var anyHandler: ((SocketAnyEvent) -> ())?
|
||||
private var currentReconnectAttempt = 0
|
||||
private var handlers = [SocketEventHandler]()
|
||||
private var reconnecting = false
|
||||
|
||||
// MARK: Initializers
|
||||
|
||||
@@ -147,13 +152,11 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
private func addEngine() -> SocketEngineSpec {
|
||||
private func addEngine() {
|
||||
DefaultSocketLogger.Logger.log("Adding engine", type: logType, args: "")
|
||||
|
||||
engine?.client = nil
|
||||
engine = SocketEngine(client: self, url: socketURL, config: config)
|
||||
|
||||
return engine!
|
||||
}
|
||||
|
||||
/// Connect to the server.
|
||||
@@ -166,7 +169,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
/// - 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: (() -> Void)?) {
|
||||
open func connect(timeoutAfter: Int, withHandler handler: (() -> ())?) {
|
||||
assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)")
|
||||
|
||||
guard status != .connected else {
|
||||
@@ -177,17 +180,15 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
status = .connecting
|
||||
|
||||
if engine == nil || forceNew {
|
||||
addEngine().connect()
|
||||
} else {
|
||||
engine?.connect()
|
||||
addEngine()
|
||||
}
|
||||
|
||||
engine?.connect()
|
||||
|
||||
guard timeoutAfter != 0 else { return }
|
||||
|
||||
let time = DispatchTime.now() + Double(UInt64(timeoutAfter) * NSEC_PER_SEC) / Double(NSEC_PER_SEC)
|
||||
|
||||
handleQueue.asyncAfter(deadline: time) {[weak self] in
|
||||
guard let this = self, this.status != .connected && this.status != .disconnected 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")
|
||||
@@ -232,13 +233,19 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
|
||||
/// 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 {
|
||||
emit(event, with: try items.map({ try $0.socketRepresentation() }))
|
||||
} catch {
|
||||
fatalError("Error creating socketRepresentation for emit: \(event), \(items)")
|
||||
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])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +267,9 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
/// **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
|
||||
@@ -274,8 +284,13 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
open func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback {
|
||||
do {
|
||||
return emitWithAck(event, with: try items.map({ try $0.socketRepresentation() }))
|
||||
} catch {
|
||||
fatalError("Error creating socketRepresentation for emit: \(event), \(items)")
|
||||
} 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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,7 +441,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
|
||||
/// Removes handler(s) based on an event name.
|
||||
///
|
||||
/// If you wish to remove a specific event, call the `off(if:)` with the UUID received from its `on` call.
|
||||
/// 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) {
|
||||
@@ -484,7 +499,6 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
return handler.id
|
||||
}
|
||||
|
||||
|
||||
/// Adds a single-use handler for an event.
|
||||
///
|
||||
/// - parameter event: The event name for this handler.
|
||||
@@ -510,7 +524,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
/// 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) -> Void) {
|
||||
open func onAny(_ handler: @escaping (SocketAnyEvent) -> ()) {
|
||||
anyHandler = handler
|
||||
}
|
||||
|
||||
@@ -555,9 +569,9 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
|
||||
}
|
||||
|
||||
private func _tryReconnect() {
|
||||
guard reconnecting else { return }
|
||||
guard reconnects && reconnecting && status != .disconnected else { return }
|
||||
|
||||
if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts || !reconnects {
|
||||
if reconnectAttempts != -1 && currentReconnectAttempt + 1 > reconnectAttempts {
|
||||
return didDisconnect(reason: "Reconnect Failed")
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ public enum SocketIOClientOption : ClientOption {
|
||||
/// An array of cookies that will be sent during the initial connection.
|
||||
case cookies([HTTPCookie])
|
||||
|
||||
/// The node.js socket.io currently does funky things to unicode when doing HTTP long-polling. Passing `true` in
|
||||
/// this option causes the client to try and fix any bad unicode that might be sent.
|
||||
/// 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.
|
||||
|
||||
@@ -107,7 +107,7 @@ extension SocketParsable where Self: SocketIOClientSpec {
|
||||
}
|
||||
}
|
||||
|
||||
var dataArray = message[message.characters.index(reader.currentIndex, offsetBy: 1)..<message.endIndex]
|
||||
var dataArray = String(message.utf16[message.utf16.index(reader.currentIndex, offsetBy: 1)..<message.utf16.endIndex])!
|
||||
|
||||
if type == .error && !dataArray.hasPrefix("[") && !dataArray.hasSuffix("]") {
|
||||
dataArray = "[" + dataArray + "]"
|
||||
|
||||
@@ -24,50 +24,50 @@
|
||||
|
||||
struct SocketStringReader {
|
||||
let message: String
|
||||
var currentIndex: String.Index
|
||||
var currentIndex: String.UTF16View.Index
|
||||
var hasNext: Bool {
|
||||
return currentIndex != message.endIndex
|
||||
return currentIndex != message.utf16.endIndex
|
||||
}
|
||||
|
||||
|
||||
var currentCharacter: String {
|
||||
return String(message[currentIndex])
|
||||
return String(UnicodeScalar(message.utf16[currentIndex])!)
|
||||
}
|
||||
|
||||
|
||||
init(message: String) {
|
||||
self.message = message
|
||||
currentIndex = message.startIndex
|
||||
currentIndex = message.utf16.startIndex
|
||||
}
|
||||
|
||||
|
||||
@discardableResult
|
||||
mutating func advance(by: Int) -> String.Index {
|
||||
currentIndex = message.characters.index(currentIndex, offsetBy: by)
|
||||
|
||||
mutating func advance(by: Int) -> String.UTF16View.Index {
|
||||
currentIndex = message.utf16.index(currentIndex, offsetBy: by)
|
||||
|
||||
return currentIndex
|
||||
}
|
||||
|
||||
|
||||
mutating func read(count: Int) -> String {
|
||||
let readString = message[currentIndex..<message.characters.index(currentIndex, offsetBy: count)]
|
||||
|
||||
let readString = String(message.utf16[currentIndex..<message.utf16.index(currentIndex, offsetBy: count)])!
|
||||
|
||||
advance(by: count)
|
||||
|
||||
|
||||
return readString
|
||||
}
|
||||
|
||||
|
||||
mutating func readUntilOccurence(of string: String) -> String {
|
||||
let substring = message[currentIndex..<message.endIndex]
|
||||
|
||||
guard let foundRange = substring.range(of: string) else {
|
||||
currentIndex = message.endIndex
|
||||
|
||||
return substring
|
||||
let substring = message.utf16[currentIndex..<message.utf16.endIndex]
|
||||
|
||||
guard let foundIndex = substring.index(of: string.utf16.first!) else {
|
||||
currentIndex = message.utf16.endIndex
|
||||
|
||||
return String(substring)!
|
||||
}
|
||||
|
||||
advance(by: message.characters.distance(from: message.characters.startIndex, to: foundRange.lowerBound) + 1)
|
||||
|
||||
return substring.substring(to: foundRange.lowerBound)
|
||||
|
||||
advance(by: substring.distance(from: substring.startIndex, to: foundIndex) + 1)
|
||||
|
||||
return String(substring[substring.startIndex..<foundIndex])!
|
||||
}
|
||||
|
||||
|
||||
mutating func readUntilEnd() -> String {
|
||||
return read(count: message.characters.distance(from: currentIndex, to: message.endIndex))
|
||||
return read(count: message.utf16.distance(from: currentIndex, to: message.utf16.endIndex))
|
||||
}
|
||||
}
|
||||
@@ -68,10 +68,10 @@ extension NSNull : SocketData { }
|
||||
extension String : SocketData { }
|
||||
|
||||
/// A typealias for an ack callback.
|
||||
public typealias AckCallback = ([Any]) -> Void
|
||||
public typealias AckCallback = ([Any]) -> ()
|
||||
|
||||
/// A typealias for a normal callback.
|
||||
public typealias NormalCallback = ([Any], SocketAckEmitter) -> Void
|
||||
public typealias NormalCallback = ([Any], SocketAckEmitter) -> ()
|
||||
|
||||
typealias JSON = [String: Any]
|
||||
typealias Probe = (msg: String, type: SocketEnginePacketType, data: [Data])
|
||||
|
||||
@@ -115,7 +115,7 @@ open class WebSocket : NSObject, StreamDelegate {
|
||||
|
||||
|
||||
// MARK: - Block based API.
|
||||
public var onConnect: ((Void) -> Void)?
|
||||
public var onConnect: (() -> Void)?
|
||||
public var onDisconnect: ((NSError?) -> Void)?
|
||||
public var onText: ((String) -> Void)?
|
||||
public var onData: ((Data) -> Void)?
|
||||
|
||||
+1
-1
@@ -465,7 +465,7 @@ 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-07)</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-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>
|
||||
|
||||
@@ -266,7 +266,7 @@ 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-07)</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-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>
|
||||
|
||||
@@ -288,7 +288,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -381,7 +381,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -248,6 +248,9 @@
|
||||
<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>
|
||||
will be emitted. The structure of the error data is <code>[ackNum, items, theError]</code></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
@@ -333,7 +336,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -282,7 +282,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -470,7 +470,7 @@ 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-07)</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-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>
|
||||
|
||||
@@ -418,34 +418,6 @@ disconnect us.</p>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vC8SocketIO12SocketEngine16doubleEncodeUTF8Sb"></a>
|
||||
<a name="//apple_ref/swift/Property/doubleEncodeUTF8" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vC8SocketIO12SocketEngine16doubleEncodeUTF8Sb">doubleEncodeUTF8</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Set to <code>true</code> if using the node.js version of socket.io. The node.js version of socket.io
|
||||
handles utf8 incorrectly.</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">private(set)</span> <span class="k">var</span> <span class="nv">doubleEncodeUTF8</span> <span class="o">=</span> <span class="kc">true</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
@@ -1224,9 +1196,9 @@ the engine is attempting to upgrade to WebSocket it does not do any POSTing.</p>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FC8SocketIO12SocketEngine18parseEngineMessageFTSS11fromPollingSb_T_"></a>
|
||||
<a name="//apple_ref/swift/Method/parseEngineMessage(_:fromPolling:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO12SocketEngine18parseEngineMessageFTSS11fromPollingSb_T_">parseEngineMessage(_:fromPolling:)</a>
|
||||
<a name="/s:FC8SocketIO12SocketEngine18parseEngineMessageFSST_"></a>
|
||||
<a name="//apple_ref/swift/Method/parseEngineMessage(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FC8SocketIO12SocketEngine18parseEngineMessageFSST_">parseEngineMessage(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -1241,7 +1213,7 @@ the engine is attempting to upgrade to WebSocket it does not do any POSTing.</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">parseEngineMessage</span><span class="p">(</span><span class="n">_</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">fromPolling</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">parseEngineMessage</span><span class="p">(</span><span class="n">_</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1461,7 +1433,7 @@ the engine is attempting to upgrade to WebSocket it does not do any POSTing.</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-07)</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-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>
|
||||
|
||||
@@ -733,6 +733,9 @@ If using Swift it’s recommended to use <code>init(socketURL: NSURL, option
|
||||
<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:FO8SocketIO17SocketClientEvent5errorFMS0_S0_">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>
|
||||
@@ -852,6 +855,9 @@ If using Swift it’s recommended to use <code>init(socketURL: NSURL, option
|
||||
<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:FO8SocketIO17SocketClientEvent5errorFMS0_S0_">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>
|
||||
@@ -1286,7 +1292,7 @@ Check that your server’s api will ack the event being sent.</p>
|
||||
<div class="abstract">
|
||||
<p>Removes handler(s) based on an event name.</p>
|
||||
|
||||
<p>If you wish to remove a specific event, call the <code>off(if:)</code> with the UUID received from its <code>on</code> call.</p>
|
||||
<p>If you wish to remove a specific event, call the <code><a href="../Classes/SocketIOClient.html#/s:FC8SocketIO14SocketIOClient3offFT2idV10Foundation4UUID_T_">off(id:)</a></code> with the UUID received from its <code>on</code> call.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
@@ -1762,7 +1768,7 @@ Can be used after disconnecting to break any potential remaining retain cycles.<
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -906,7 +906,7 @@ Yodel a sound to the planet. This sends it as an astroid. <a href="http://
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -368,7 +368,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
+1
-1
@@ -343,7 +343,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -376,7 +376,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -407,7 +407,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -261,8 +261,7 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The node.js socket.io currently does funky things to unicode when doing HTTP long-polling. Passing <code>true</code> in
|
||||
this option causes the client to try and fix any bad unicode that might be sent.</p>
|
||||
<p>Deprecated</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
@@ -927,7 +926,7 @@ 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-07)</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-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>
|
||||
|
||||
@@ -314,7 +314,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
+1
-1
@@ -456,7 +456,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -249,7 +249,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -431,7 +431,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -494,7 +494,7 @@ disconnect us.</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-07)</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-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>
|
||||
|
||||
@@ -294,34 +294,6 @@
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vP8SocketIO16SocketEngineSpec16doubleEncodeUTF8Sb"></a>
|
||||
<a name="//apple_ref/swift/Property/doubleEncodeUTF8" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vP8SocketIO16SocketEngineSpec16doubleEncodeUTF8Sb">doubleEncodeUTF8</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Set to <code>true</code> if using the node.js version of socket.io. The node.js version of socket.io
|
||||
handles utf8 incorrectly.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">var</span> <span class="nv">doubleEncodeUTF8</span><span class="p">:</span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
@@ -979,9 +951,9 @@ the engine is attempting to upgrade to WebSocket it does not do any POSTing.</p>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FP8SocketIO16SocketEngineSpec18parseEngineMessageFTSS11fromPollingSb_T_"></a>
|
||||
<a name="//apple_ref/swift/Method/parseEngineMessage(_:fromPolling:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FP8SocketIO16SocketEngineSpec18parseEngineMessageFTSS11fromPollingSb_T_">parseEngineMessage(_:fromPolling:)</a>
|
||||
<a name="/s:FP8SocketIO16SocketEngineSpec18parseEngineMessageFSST_"></a>
|
||||
<a name="//apple_ref/swift/Method/parseEngineMessage(_:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FP8SocketIO16SocketEngineSpec18parseEngineMessageFSST_">parseEngineMessage(_:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -996,7 +968,7 @@ the engine is attempting to upgrade to WebSocket it does not do any POSTing.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">func</span> <span class="nf">parseEngineMessage</span><span class="p">(</span><span class="n">_</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">fromPolling</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight"><code><span class="kd">func</span> <span class="nf">parseEngineMessage</span><span class="p">(</span><span class="n">_</span> <span class="nv">message</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1113,7 +1085,7 @@ the engine is attempting to upgrade to WebSocket it does not do any POSTing.</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-07)</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-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>
|
||||
|
||||
@@ -347,7 +347,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -395,7 +395,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -264,7 +264,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
+1
-1
@@ -215,7 +215,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -642,7 +642,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
@@ -241,7 +241,7 @@
|
||||
</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-07)</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-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>
|
||||
|
||||
+5
-5
@@ -220,7 +220,7 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{
|
||||
<h2 id='features' class='heading'>Features</h2>
|
||||
|
||||
<ul>
|
||||
<li>Supports socket.io 1.0+</li>
|
||||
<li>Supports socket.io 2.0+ (For socket.io 1.0 use v9.x)</li>
|
||||
<li>Supports binary</li>
|
||||
<li>Supports Polling and WebSockets</li>
|
||||
<li>Supports TLS/SSL</li>
|
||||
@@ -262,7 +262,7 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{
|
||||
<h3 id='carthage' class='heading'>Carthage</h3>
|
||||
|
||||
<p>Add this line to your <code>Cartfile</code>:</p>
|
||||
<pre class="highlight plaintext"><code>github "socketio/socket.io-client-swift" ~> 9.0.0 # Or latest version
|
||||
<pre class="highlight plaintext"><code>github "socketio/socket.io-client-swift" ~> 9.0.1 # Or latest version
|
||||
</code></pre>
|
||||
|
||||
<p>Run <code>carthage update --platform ios,macosx</code>.</p>
|
||||
@@ -272,7 +272,7 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{
|
||||
<pre class="highlight ruby"><code><span class="n">use_frameworks!</span>
|
||||
|
||||
<span class="n">target</span> <span class="s1">'YourApp'</span> <span class="k">do</span>
|
||||
<span class="n">pod</span> <span class="s1">'Socket.IO-Client-Swift'</span><span class="p">,</span> <span class="s1">'~> 9.0.0'</span> <span class="c1"># Or latest version</span>
|
||||
<span class="n">pod</span> <span class="s1">'Socket.IO-Client-Swift'</span><span class="p">,</span> <span class="s1">'~> 9.0.1'</span> <span class="c1"># Or latest version</span>
|
||||
<span class="k">end</span>
|
||||
</code></pre>
|
||||
|
||||
@@ -292,7 +292,7 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{
|
||||
<h3 id='cocoaseeds' class='heading'>CocoaSeeds</h3>
|
||||
|
||||
<p>Add this line to your <code>Seedfile</code>:</p>
|
||||
<pre class="highlight plaintext"><code>github "socketio/socket.io-client-swift", "v9.0.0", :files => "Source/*.swift" # Or latest version
|
||||
<pre class="highlight plaintext"><code>github "socketio/socket.io-client-swift", "v9.0.1", :files => "Source/*.swift" # Or latest version
|
||||
</code></pre>
|
||||
|
||||
<p>Run <code>seed install</code>.</p>
|
||||
@@ -319,7 +319,7 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{
|
||||
</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-07)</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-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>
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"Typealiases.html#/s:8SocketIO14NormalCallback":{"name":"NormalCallback","abstract":"<p>A typealias for a normal callback.</p>"},"Typealiases.html#/s:8SocketIO11AckCallback":{"name":"AckCallback","abstract":"<p>A typealias for an ack callback.</p>"},"Structs/SocketIOClientConfiguration.html#/s:V8SocketIO27SocketIOClientConfiguration8Iterator":{"name":"Iterator","abstract":"<p>Iterator type.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:V8SocketIO27SocketIOClientConfiguration7Element":{"name":"Element","abstract":"<p>Type of element stored.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:V8SocketIO27SocketIOClientConfiguration11SubSequence":{"name":"SubSequence","abstract":"<p>SubSequence type.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:V8SocketIO27SocketIOClientConfiguration5Index":{"name":"Index","abstract":"<p>Index type.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration10startIndexSi":{"name":"startIndex","abstract":"<p>The start index of this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration8endIndexSi":{"name":"endIndex","abstract":"<p>The end index of this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration7isEmptySb":{"name":"isEmpty","abstract":"<p>Whether this collection is empty.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration5countSi":{"name":"count","abstract":"<p>The number of elements stored in this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration5firstGSqOS_20SocketIOClientOption_":{"name":"first","abstract":"<p>The first element in this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:FV8SocketIO27SocketIOClientConfigurationcFt12arrayLiteralGSaOS_20SocketIOClientOption__S0_":{"name":"init(arrayLiteral:)","abstract":"<p>Creates a new <code>SocketIOClientConfiguration</code> from an array literal.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:FV8SocketIO27SocketIOClientConfiguration12makeIteratorFT_GVs16IndexingIteratorGSaOS_20SocketIOClientOption__":{"name":"makeIterator()","abstract":"<p>Creates an iterator for this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:FV8SocketIO27SocketIOClientConfiguration5indexFT5afterSi_Si":{"name":"index(after:)","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:FV8SocketIO27SocketIOClientConfiguration6insertFTOS_20SocketIOClientOption9replacingSb_T_":{"name":"insert(_:replacing:)","abstract":"<p>Special method that inserts <code>element</code> into the collection, replacing any other instances of <code>element</code>.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html":{"name":"SocketIOClientConfiguration","abstract":"<p>An array-like type that holds <code><a href=\"36f8f5912051ae747ef441d6511ca4cbEnums/SocketIOClientOption.html\">SocketIOClientOption</a></code>s</p>"},"Protocols/SSLTrustValidator.html#/s:FP8SocketIO17SSLTrustValidator7isValidFTCSo8SecTrust6domainGSqSS__Sb":{"name":"isValid(_:domain:)","abstract":"<p>Undocumented</p>","parent_name":"SSLTrustValidator"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient14engineDidErrorFT6reasonSS_T_":{"name":"engineDidError(reason:)","abstract":"<p>Called when the engine errors.</p>","parent_name":"SocketEngineClient"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient14engineDidCloseFT6reasonSS_T_":{"name":"engineDidClose(reason:)","abstract":"<p>Called when the engine closes.</p>","parent_name":"SocketEngineClient"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient13engineDidOpenFT6reasonSS_T_":{"name":"engineDidOpen(reason:)","abstract":"<p>Called when the engine opens.</p>","parent_name":"SocketEngineClient"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient18parseEngineMessageFSST_":{"name":"parseEngineMessage(_:)","abstract":"<p>Called when the engine has a message that must be parsed.</p>","parent_name":"SocketEngineClient"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient21parseEngineBinaryDataFV10Foundation4DataT_":{"name":"parseEngineBinaryData(_:)","abstract":"<p>Called when the engine receives binary data.</p>","parent_name":"SocketEngineClient"},"Protocols/WebSocketPongDelegate.html#/s:FP8SocketIO21WebSocketPongDelegate23websocketDidReceivePongFT6sockLine truncated
|
||||
{"Typealiases.html#/s:8SocketIO14NormalCallback":{"name":"NormalCallback","abstract":"<p>A typealias for a normal callback.</p>"},"Typealiases.html#/s:8SocketIO11AckCallback":{"name":"AckCallback","abstract":"<p>A typealias for an ack callback.</p>"},"Structs/SocketIOClientConfiguration.html#/s:V8SocketIO27SocketIOClientConfiguration8Iterator":{"name":"Iterator","abstract":"<p>Iterator type.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:V8SocketIO27SocketIOClientConfiguration7Element":{"name":"Element","abstract":"<p>Type of element stored.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:V8SocketIO27SocketIOClientConfiguration11SubSequence":{"name":"SubSequence","abstract":"<p>SubSequence type.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:V8SocketIO27SocketIOClientConfiguration5Index":{"name":"Index","abstract":"<p>Index type.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration10startIndexSi":{"name":"startIndex","abstract":"<p>The start index of this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration8endIndexSi":{"name":"endIndex","abstract":"<p>The end index of this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration7isEmptySb":{"name":"isEmpty","abstract":"<p>Whether this collection is empty.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration5countSi":{"name":"count","abstract":"<p>The number of elements stored in this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:vV8SocketIO27SocketIOClientConfiguration5firstGSqOS_20SocketIOClientOption_":{"name":"first","abstract":"<p>The first element in this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:FV8SocketIO27SocketIOClientConfigurationcFt12arrayLiteralGSaOS_20SocketIOClientOption__S0_":{"name":"init(arrayLiteral:)","abstract":"<p>Creates a new <code>SocketIOClientConfiguration</code> from an array literal.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:FV8SocketIO27SocketIOClientConfiguration12makeIteratorFT_GVs16IndexingIteratorGSaOS_20SocketIOClientOption__":{"name":"makeIterator()","abstract":"<p>Creates an iterator for this collection.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:FV8SocketIO27SocketIOClientConfiguration5indexFT5afterSi_Si":{"name":"index(after:)","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html#/s:FV8SocketIO27SocketIOClientConfiguration6insertFTOS_20SocketIOClientOption9replacingSb_T_":{"name":"insert(_:replacing:)","abstract":"<p>Special method that inserts <code>element</code> into the collection, replacing any other instances of <code>element</code>.</p>","parent_name":"SocketIOClientConfiguration"},"Structs/SocketIOClientConfiguration.html":{"name":"SocketIOClientConfiguration","abstract":"<p>An array-like type that holds <code><a href=\"36f8f5912051ae747ef441d6511ca4cbEnums/SocketIOClientOption.html\">SocketIOClientOption</a></code>s</p>"},"Protocols/SSLTrustValidator.html#/s:FP8SocketIO17SSLTrustValidator7isValidFTCSo8SecTrust6domainGSqSS__Sb":{"name":"isValid(_:domain:)","abstract":"<p>Undocumented</p>","parent_name":"SSLTrustValidator"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient14engineDidErrorFT6reasonSS_T_":{"name":"engineDidError(reason:)","abstract":"<p>Called when the engine errors.</p>","parent_name":"SocketEngineClient"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient14engineDidCloseFT6reasonSS_T_":{"name":"engineDidClose(reason:)","abstract":"<p>Called when the engine closes.</p>","parent_name":"SocketEngineClient"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient13engineDidOpenFT6reasonSS_T_":{"name":"engineDidOpen(reason:)","abstract":"<p>Called when the engine opens.</p>","parent_name":"SocketEngineClient"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient18parseEngineMessageFSST_":{"name":"parseEngineMessage(_:)","abstract":"<p>Called when the engine has a message that must be parsed.</p>","parent_name":"SocketEngineClient"},"Protocols/SocketEngineClient.html#/s:FP8SocketIO18SocketEngineClient21parseEngineBinaryDataFV10Foundation4DataT_":{"name":"parseEngineBinaryData(_:)","abstract":"<p>Called when the engine receives binary data.</p>","parent_name":"SocketEngineClient"},"Protocols/WebSocketPongDelegate.html#/s:FP8SocketIO21WebSocketPongDelegate23websocketDidReceivePongFT6sockLine truncated
|
||||
Reference in new issue
Block a user