@@ -62,7 +62,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
6262 return self . _connecting
6363 }
6464 public var cookies : [ NSHTTPCookie ] ?
65- public var engine : SocketEngine !
65+ public var engine : SocketEngine ?
6666 public var nsp = " / "
6767 public var reconnects = true
6868 public var reconnecting : Bool {
@@ -170,7 +170,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
170170 self . _connecting = false
171171 self . _connected = false
172172 self . _reconnecting = false
173- self . engine. close ( fast: fast)
173+ self . engine? . close ( fast: fast)
174174 }
175175
176176 /**
@@ -187,7 +187,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
187187 }
188188
189189 self . addEngine ( )
190- self . engine. open ( )
190+ self . engine? . open ( )
191191 }
192192
193193 /**
@@ -207,7 +207,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
207207 self . paramConnect = true
208208
209209 self . addEngine ( )
210- self . engine. open ( opts: params)
210+ self . engine? . open ( opts: params)
211211 }
212212
213213 private func createOnAck( event: String , items: [ AnyObject ] ) -> OnAckCallback {
@@ -242,7 +242,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
242242 self . currentReconnectAttempt = 0
243243 self . reconnectTimer? . invalidate ( )
244244 self . reconnectTimer = nil
245- self . _sid = self . engine. sid
245+ self . _sid = self . engine? . sid
246246
247247 // Don't handle as internal because something crazy could happen where
248248 // we disconnect before it's handled
@@ -327,9 +327,9 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
327327 SocketLogger . log ( " Emitting: \( str) " , client: self )
328328
329329 if packet. type == SocketPacket . PacketType. BINARY_EVENT {
330- self . engine. send ( str, withData: packet. binary)
330+ self . engine? . send ( str, withData: packet. binary)
331331 } else {
332- self . engine. send ( str, withData: nil )
332+ self . engine? . send ( str, withData: nil )
333333 }
334334 }
335335
@@ -349,9 +349,9 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
349349 SocketLogger . log ( " Emitting Ack: \( str) " , client: self !)
350350
351351 if packet. type == SocketPacket . PacketType. BINARY_ACK {
352- self ? . engine. send ( str, withData: packet. binary)
352+ self ? . engine? . send ( str, withData: packet. binary)
353353 } else {
354- self ? . engine. send ( str, withData: nil )
354+ self ? . engine? . send ( str, withData: nil )
355355 }
356356 }
357357 }
@@ -413,7 +413,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
413413 SocketLogger . log ( " Joining namespace " , client: self )
414414
415415 if self . nsp != " / " {
416- self . engine. send ( " 0/ \( self . nsp) " , withData: nil )
416+ self . engine? . send ( " 0/ \( self . nsp) " , withData: nil )
417417 }
418418 }
419419
0 commit comments