Add compress option
This commit is contained in:
parent
839987727e
commit
7ff10d141f
@ -60,6 +60,9 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
|||||||
/// `true` if this engine is closed.
|
/// `true` if this engine is closed.
|
||||||
public private(set) var closed = false
|
public private(set) var closed = false
|
||||||
|
|
||||||
|
/// If `true` the engine will attempt to use WebSocket compression.
|
||||||
|
public private(set) var compress = false
|
||||||
|
|
||||||
/// `true` if this engine is connected. Connected means that the initial poll connect has succeeded.
|
/// `true` if this engine is connected. Connected means that the initial poll connect has succeeded.
|
||||||
public private(set) var connected = false
|
public private(set) var connected = false
|
||||||
|
|
||||||
@ -171,6 +174,8 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
|||||||
self.selfSigned = selfSigned
|
self.selfSigned = selfSigned
|
||||||
case let .security(security):
|
case let .security(security):
|
||||||
self.security = security
|
self.security = security
|
||||||
|
case .compress:
|
||||||
|
self.compress = true
|
||||||
default:
|
default:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -331,6 +336,7 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
|
|||||||
}
|
}
|
||||||
|
|
||||||
ws?.callbackQueue = engineQueue
|
ws?.callbackQueue = engineQueue
|
||||||
|
ws?.enableCompression = compress
|
||||||
ws?.delegate = self
|
ws?.delegate = self
|
||||||
ws?.disableSSLCertValidation = selfSigned
|
ws?.disableSSLCertValidation = selfSigned
|
||||||
ws?.security = security
|
ws?.security = security
|
||||||
|
|||||||
@ -30,6 +30,9 @@ protocol ClientOption : CustomStringConvertible, Equatable {
|
|||||||
|
|
||||||
/// The options for a client.
|
/// The options for a client.
|
||||||
public enum SocketIOClientOption : ClientOption {
|
public enum SocketIOClientOption : ClientOption {
|
||||||
|
/// If given, the WebSocket transport will attempt to use compression.
|
||||||
|
case compress
|
||||||
|
|
||||||
/// A dictionary of GET parameters that will be included in the connect url.
|
/// A dictionary of GET parameters that will be included in the connect url.
|
||||||
case connectParams([String: Any])
|
case connectParams([String: Any])
|
||||||
|
|
||||||
@ -103,6 +106,8 @@ public enum SocketIOClientOption : ClientOption {
|
|||||||
let description: String
|
let description: String
|
||||||
|
|
||||||
switch self {
|
switch self {
|
||||||
|
case .compress:
|
||||||
|
description = "compress"
|
||||||
case .connectParams:
|
case .connectParams:
|
||||||
description = "connectParams"
|
description = "connectParams"
|
||||||
case .cookies:
|
case .cookies:
|
||||||
@ -152,6 +157,8 @@ public enum SocketIOClientOption : ClientOption {
|
|||||||
let value: Any
|
let value: Any
|
||||||
|
|
||||||
switch self {
|
switch self {
|
||||||
|
case .compress:
|
||||||
|
value = true
|
||||||
case let .connectParams(params):
|
case let .connectParams(params):
|
||||||
value = params
|
value = params
|
||||||
case let .cookies(cookies):
|
case let .cookies(cookies):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user