set secure for legacy api

This commit is contained in:
Erik 2015-10-29 18:29:56 -04:00
parent 47fd0e386f
commit f6dabf8f8e

View File

@ -58,15 +58,16 @@ public final class SocketIOClient: NSObject, SocketEngineClient {
Type safe way to create a new SocketIOClient. opts can be omitted Type safe way to create a new SocketIOClient. opts can be omitted
*/ */
public init(var socketURL: String, options: Set<SocketIOClientOption>? = nil) { public init(var socketURL: String, options: Set<SocketIOClientOption>? = nil) {
self.options = options
if socketURL["https://"].matches().count != 0 { if socketURL["https://"].matches().count != 0 {
self.secure = true self.options?.insertIgnore(.Secure(true))
} }
socketURL = socketURL["http://"] ~= "" socketURL = socketURL["http://"] ~= ""
socketURL = socketURL["https://"] ~= "" socketURL = socketURL["https://"] ~= ""
self.socketURL = socketURL self.socketURL = socketURL
self.options = options
for option in options ?? [] { for option in options ?? [] {
switch option { switch option {