add option for selfSigned

This commit is contained in:
Erik 2015-12-08 20:15:54 -05:00
parent 275c873880
commit 238d3cb338
3 changed files with 8 additions and 0 deletions

View File

@ -146,6 +146,7 @@ case ExtraHeaders([String: String]) // Adds custom headers to the initial reques
case HandleQueue(dispatch_queue_t) // The dispatch queue that handlers are run on. Default is the main queue.
case VoipEnabled(Bool) // Only use this option if you're using the client with VoIP services. Changes the way the WebSocket is created. Default is false
case Secure(Bool) // If the connection should use TLS. Default is false.
case SelfSigned(Bool) // Sets WebSocket.selfSignedSSL (Don't do this, iOS will yell at you)
```
Methods

View File

@ -67,6 +67,7 @@ public final class SocketEngine: NSObject, SocketEngineSpec, WebSocketDelegate {
private var probing = false
private var probeWait = ProbeWaitQueue()
private var secure = false
private var selfSigned = false
private var session: NSURLSession?
private var voipEnabled = false
private var waitingForPoll = false
@ -98,6 +99,8 @@ public final class SocketEngine: NSObject, SocketEngineSpec, WebSocketDelegate {
voipEnabled = enable
case .Secure(let secure):
self.secure = secure
case .SelfSigned(let selfSigned):
self.selfSigned = selfSigned
default:
continue
}
@ -255,6 +258,7 @@ public final class SocketEngine: NSObject, SocketEngineSpec, WebSocketDelegate {
ws?.queue = handleQueue
ws?.voipEnabled = voipEnabled
ws?.delegate = self
ws?.selfSignedSSL = selfSigned
if connect {
ws?.connect()

View File

@ -44,6 +44,7 @@ public enum SocketIOClientOption: ClientOption {
case ReconnectAttempts(Int)
case ReconnectWait(Int)
case Secure(Bool)
case SelfSigned(Bool)
case SessionDelegate(NSURLSessionDelegate)
case VoipEnabled(Bool)
@ -95,6 +96,8 @@ public enum SocketIOClientOption: ClientOption {
return .VoipEnabled(enable)
case ("secure", let secure as Bool):
return .Secure(secure)
case ("selfSigned", let selfSigned as Bool):
return .SelfSigned(selfSigned)
default:
return nil
}