@@ -31,8 +31,6 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
3131 private var _connected = false
3232 private var _connecting = false
3333 private var currentReconnectAttempt = 0
34- private var forcePolling = false
35- private var forceWebsockets = false
3634 private var handlers = ContiguousArray < SocketEventHandler > ( )
3735 private var paramConnect = false
3836 private var _secure = false
@@ -61,9 +59,9 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
6159 public var connecting : Bool {
6260 return self . _connecting
6361 }
64- public var cookies : [ NSHTTPCookie ] ?
6562 public var engine : SocketEngine ?
6663 public var nsp = " / "
64+ public var opts : [ String : AnyObject ] ?
6765 public var reconnects = true
6866 public var reconnecting : Bool {
6967 return self . _reconnecting
@@ -75,13 +73,11 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
7573 public var sid : String ? {
7674 return self . _sid
7775 }
78- public var socketPath = " "
79-
8076
8177 /**
8278 Create a new SocketIOClient. opts can be omitted
8379 */
84- public init ( var socketURL: String , opts: NSDictionary ? = nil ) {
80+ public init ( var socketURL: String , opts: [ String : AnyObject ] ? = nil ) {
8581 if socketURL [ " https:// " ] . matches ( ) . count != 0 {
8682 self . _secure = true
8783 }
@@ -90,29 +86,18 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
9086 socketURL = socketURL [ " https:// " ] ~= " "
9187
9288 self . socketURL = socketURL
89+ self . opts = opts
9390
9491 // Set options
9592 if opts != nil {
9693 if let sessionDelegate = opts![ " sessionDelegate " ] as? NSURLSessionDelegate {
9794 self . sessionDelegate = sessionDelegate
9895 }
9996
100- if let cookies = opts![ " cookies " ] as? [ NSHTTPCookie ] {
101- self . cookies = cookies
102- }
103-
10497 if let log = opts![ " log " ] as? Bool {
10598 self . log = log
10699 }
107100
108- if let path = opts![ " path " ] as? String {
109- self . socketPath = path
110- }
111-
112- if let polling = opts![ " forcePolling " ] as? Bool {
113- self . forcePolling = polling
114- }
115-
116101 if var nsp = opts![ " nsp " ] as? String {
117102 if nsp != " / " && nsp. hasPrefix ( " / " ) {
118103 nsp. removeAtIndex ( nsp. startIndex)
@@ -134,18 +119,14 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
134119 if let reconnectWait = opts![ " reconnectWait " ] as? Int {
135120 self . reconnectWait = abs ( reconnectWait)
136121 }
137-
138- if let ws = opts![ " forceWebsockets " ] as? Bool {
139- self . forceWebsockets = ws
140- }
141122 } else {
142123 self . reconnectAttempts = - 1
143124 }
144125
145126 super. init ( )
146127 }
147128
148- public convenience init ( socketURL: String , options: NSDictionary ? ) {
129+ public convenience init ( socketURL: String , options: [ String : AnyObject ] ? ) {
149130 self . init ( socketURL: socketURL, opts: options)
150131 }
151132
@@ -156,14 +137,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
156137 private func addEngine( ) {
157138 SocketLogger . log ( " Adding engine " , client: self )
158139
159- self . engine = SocketEngine ( client: self ,
160- forcePolling: self . forcePolling,
161- forceWebsockets: self . forceWebsockets,
162- cookies: self . cookies,
163- logging: self . log,
164- sessionDelegate: self . sessionDelegate,
165- path: self . socketPath
166- )
140+ self . engine = SocketEngine ( client: self , opts: self . opts)
167141 }
168142
169143 /**
0 commit comments