@@ -62,7 +62,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
62
62
return self . _connecting
63
63
}
64
64
public var cookies : [ NSHTTPCookie ] ?
65
- public var engine : SocketEngine ?
65
+ public var engine : SocketEngine !
66
66
public var nsp = " / "
67
67
public var reconnects = true
68
68
public var reconnecting : Bool {
@@ -143,6 +143,10 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
143
143
self . init ( socketURL: socketURL, opts: options)
144
144
}
145
145
146
+ deinit {
147
+ SocketLogger . log ( " Client is being deinit " , client: self )
148
+ }
149
+
146
150
private func addEngine( ) {
147
151
SocketLogger . log ( " Adding engine " , client: self )
148
152
@@ -166,7 +170,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
166
170
self . _connecting = false
167
171
self . _connected = false
168
172
self . _reconnecting = false
169
- self . engine? . close ( fast: fast)
173
+ self . engine. close ( fast: fast)
170
174
}
171
175
172
176
/**
@@ -183,7 +187,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
183
187
}
184
188
185
189
self . addEngine ( )
186
- self . engine? . open ( )
190
+ self . engine. open ( )
187
191
}
188
192
189
193
/**
@@ -203,7 +207,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
203
207
self . paramConnect = true
204
208
205
209
self . addEngine ( )
206
- self . engine? . open ( opts: params)
210
+ self . engine. open ( opts: params)
207
211
}
208
212
209
213
private func createOnAck( event: String , items: [ AnyObject ] ) -> OnAckCallback {
@@ -238,7 +242,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
238
242
self . currentReconnectAttempt = 0
239
243
self . reconnectTimer? . invalidate ( )
240
244
self . reconnectTimer = nil
241
- self . _sid = self . engine? . sid
245
+ self . _sid = self . engine. sid
242
246
243
247
// Don't handle as internal because something crazy could happen where
244
248
// we disconnect before it's handled
@@ -323,9 +327,9 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
323
327
SocketLogger . log ( " Emitting: \( str) " , client: self )
324
328
325
329
if packet. type == SocketPacket . PacketType. BINARY_EVENT {
326
- self . engine? . send ( str, withData: packet. binary)
330
+ self . engine. send ( str, withData: packet. binary)
327
331
} else {
328
- self . engine? . send ( str, withData: nil )
332
+ self . engine. send ( str, withData: nil )
329
333
}
330
334
}
331
335
@@ -343,11 +347,11 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
343
347
str = packet. createAck ( )
344
348
345
349
SocketLogger . log ( " Emitting Ack: \( str) " , client: self !)
346
-
350
+
347
351
if packet. type == SocketPacket . PacketType. BINARY_ACK {
348
- self ? . engine? . send ( str, withData: packet. binary)
352
+ self ? . engine. send ( str, withData: packet. binary)
349
353
} else {
350
- self ? . engine? . send ( str, withData: nil )
354
+ self ? . engine. send ( str, withData: nil )
351
355
}
352
356
}
353
357
}
@@ -409,7 +413,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
409
413
SocketLogger . log ( " Joining namespace " , client: self )
410
414
411
415
if self . nsp != " / " {
412
- self . engine? . send ( " 0/ \( self . nsp) " , withData: nil )
416
+ self . engine. send ( " 0/ \( self . nsp) " , withData: nil )
413
417
}
414
418
}
415
419
0 commit comments