Merge branch 'development'
* development: update changelog/readme for 15.1 update changelog fix #1178 expose Starscream WebSocket enableSOCKSProxy option to socket.io-client-swift options
This commit is contained in:
commit
558ea65aa1
@ -1,3 +1,8 @@
|
|||||||
|
# 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
|
# v15.0.0
|
||||||
|
|
||||||
- Swift 5
|
- Swift 5
|
||||||
|
|||||||
@ -99,7 +99,7 @@ Then import `import SocketIO`.
|
|||||||
### Carthage
|
### Carthage
|
||||||
Add this line to your `Cartfile`:
|
Add this line to your `Cartfile`:
|
||||||
```
|
```
|
||||||
github "socketio/socket.io-client-swift" ~> 15.0.0
|
github "socketio/socket.io-client-swift" ~> 15.1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Run `carthage update --platform ios,macosx`.
|
Run `carthage update --platform ios,macosx`.
|
||||||
@ -113,7 +113,7 @@ Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
|
|||||||
use_frameworks!
|
use_frameworks!
|
||||||
|
|
||||||
target 'YourApp' do
|
target 'YourApp' do
|
||||||
pod 'Socket.IO-Client-Swift', '~> 15.0.0'
|
pod 'Socket.IO-Client-Swift', '~> 15.1.0'
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,9 @@ public enum SocketIOClientOption : ClientOption {
|
|||||||
/// If passed `true`, the only transport that will be used will be WebSockets.
|
/// If passed `true`, the only transport that will be used will be WebSockets.
|
||||||
case forceWebsockets(Bool)
|
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
|
/// The queue that all interaction with the client should occur on. This is the queue that event handlers are
|
||||||
/// called on.
|
/// called on.
|
||||||
///
|
///
|
||||||
@ -143,6 +146,8 @@ public enum SocketIOClientOption : ClientOption {
|
|||||||
description = "security"
|
description = "security"
|
||||||
case .sessionDelegate:
|
case .sessionDelegate:
|
||||||
description = "sessionDelegate"
|
description = "sessionDelegate"
|
||||||
|
case .enableSOCKSProxy:
|
||||||
|
description = "enableSOCKSProxy"
|
||||||
}
|
}
|
||||||
|
|
||||||
return description
|
return description
|
||||||
@ -192,6 +197,8 @@ public enum SocketIOClientOption : ClientOption {
|
|||||||
value = signed
|
value = signed
|
||||||
case let .sessionDelegate(delegate):
|
case let .sessionDelegate(delegate):
|
||||||
value = delegate
|
value = delegate
|
||||||
|
case let .enableSOCKSProxy(enable):
|
||||||
|
value = enable
|
||||||
}
|
}
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|||||||
@ -114,6 +114,9 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
|
|||||||
@available(*, deprecated, message: "No longer needed, if we're not polling, then we must be doing websockets")
|
@available(*, deprecated, message: "No longer needed, if we're not polling, then we must be doing websockets")
|
||||||
public private(set) var websocket = false
|
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.
|
/// The WebSocket for this engine.
|
||||||
public private(set) var ws: WebSocket?
|
public private(set) var ws: WebSocket?
|
||||||
|
|
||||||
@ -283,7 +286,9 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
|
|||||||
|
|
||||||
addHeaders(to: &req, includingCookies: session?.configuration.httpCookieStorage?.cookies(for: urlPollingWithSid))
|
addHeaders(to: &req, includingCookies: session?.configuration.httpCookieStorage?.cookies(for: urlPollingWithSid))
|
||||||
|
|
||||||
ws = WebSocket(request: req)
|
let stream = FoundationStream()
|
||||||
|
stream.enableSOCKSProxy = enableSOCKSProxy
|
||||||
|
ws = WebSocket(request: req, stream: stream)
|
||||||
ws?.callbackQueue = engineQueue
|
ws?.callbackQueue = engineQueue
|
||||||
ws?.enableCompression = compress
|
ws?.enableCompression = compress
|
||||||
ws?.disableSSLCertValidation = selfSigned
|
ws?.disableSSLCertValidation = selfSigned
|
||||||
@ -593,6 +598,8 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
|
|||||||
self.security = security
|
self.security = security
|
||||||
case .compress:
|
case .compress:
|
||||||
self.compress = true
|
self.compress = true
|
||||||
|
case .enableSOCKSProxy:
|
||||||
|
self.enableSOCKSProxy = true
|
||||||
default:
|
default:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,15 +62,19 @@ extension SocketEngineWebsocket {
|
|||||||
/// - parameter completion: Callback called on transport write completion.
|
/// - parameter completion: Callback called on transport write completion.
|
||||||
public func sendWebSocketMessage(_ str: String,
|
public func sendWebSocketMessage(_ str: String,
|
||||||
withType type: SocketEnginePacketType,
|
withType type: SocketEnginePacketType,
|
||||||
withData datas: [Data],
|
withData data: [Data],
|
||||||
completion: (() -> ())?
|
completion: (() -> ())?
|
||||||
) {
|
) {
|
||||||
DefaultSocketLogger.Logger.log("Sending ws: \(str) as type: \(type.rawValue)", type: "SocketEngineWebSocket")
|
DefaultSocketLogger.Logger.log("Sending ws: \(str) as type: \(type.rawValue)", type: "SocketEngineWebSocket")
|
||||||
|
|
||||||
ws?.write(string: "\(type.rawValue)\(str)")
|
ws?.write(string: "\(type.rawValue)\(str)")
|
||||||
|
|
||||||
for data in datas {
|
if data.count == 0 {
|
||||||
if case let .left(bin) = createBinaryDataForSend(using: data) {
|
completion?()
|
||||||
|
}
|
||||||
|
|
||||||
|
for item in data {
|
||||||
|
if case let .left(bin) = createBinaryDataForSend(using: item) {
|
||||||
ws?.write(data: bin, completion: completion)
|
ws?.write(data: bin, completion: completion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,6 +85,8 @@ extension Dictionary where Key == String, Value == Any {
|
|||||||
return .sessionDelegate(delegate)
|
return .sessionDelegate(delegate)
|
||||||
case let ("compress", compress as Bool):
|
case let ("compress", compress as Bool):
|
||||||
return compress ? .compress : nil
|
return compress ? .compress : nil
|
||||||
|
case let ("enableSOCKSProxy", enable as Bool):
|
||||||
|
return .enableSOCKSProxy(enable)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user