@@ -41,6 +41,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
41
41
private var reconnectTimer : NSTimer ?
42
42
43
43
let reconnectAttempts : Int !
44
+ let logType = " SocketClient "
44
45
var ackHandlers = SocketAckMap ( )
45
46
var currentAck = - 1
46
47
var log = false
@@ -138,7 +139,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
138
139
}
139
140
140
141
private func addEngine( ) {
141
- SocketLogger . log ( " Client: Adding engine" , client: self )
142
+ SocketLogger . log ( " Adding engine " , client: self )
142
143
143
144
self . engine = SocketEngine ( client: self ,
144
145
forcePolling: self . forcePolling,
@@ -153,7 +154,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
153
154
Pass true to fast if you're closing from a background task
154
155
*/
155
156
public func close( #fast: Bool) {
156
- SocketLogger . log ( " Client: Closing socket" , client: self )
157
+ SocketLogger . log ( " Closing socket " , client: self )
157
158
158
159
self . reconnects = false
159
160
self . _connecting = false
@@ -222,7 +223,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
222
223
}
223
224
224
225
func didConnect( ) {
225
- SocketLogger . log ( " Client: Socket connected" , client: self )
226
+ SocketLogger . log ( " Socket connected " , client: self )
226
227
227
228
self . _closed = false
228
229
self . _connected = true
@@ -240,7 +241,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
240
241
241
242
/// error
242
243
public func didError( reason: AnyObject ) {
243
- SocketLogger . err ( " Client: Error" , client: self )
244
+ SocketLogger . err ( " Error " , client: self )
244
245
245
246
self . handleEvent ( " error " , data: reason as? [ AnyObject ] ?? [ reason] ,
246
247
isInternalMessage: true )
@@ -313,7 +314,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
313
314
SocketParser . parseForEmit ( packet)
314
315
str = packet. createMessageForEvent ( event)
315
316
316
- SocketLogger . log ( " Client: Emitting: \( str) " , client: self )
317
+ SocketLogger . log ( " Emitting: \( str) " , client: self )
317
318
318
319
if packet. type == SocketPacket . PacketType. BINARY_EVENT {
319
320
self . engine? . send ( str, withData: packet. binary)
@@ -335,7 +336,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
335
336
SocketParser . parseForEmit ( packet)
336
337
str = packet. createAck ( )
337
338
338
- SocketLogger . log ( " Client: Emitting Ack: \( str) " , client: self !)
339
+ SocketLogger . log ( " Emitting Ack: \( str) " , client: self !)
339
340
340
341
if packet. type == SocketPacket . PacketType. BINARY_ACK {
341
342
self ? . engine? . send ( str, withData: packet. binary)
@@ -351,7 +352,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
351
352
return
352
353
}
353
354
354
- SocketLogger . log ( " Client: Engine closed" , client: self )
355
+ SocketLogger . log ( " Engine closed " , client: self )
355
356
356
357
self . _closed = true
357
358
self . _connected = false
@@ -363,7 +364,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
363
364
364
365
// Called when the socket gets an ack for something it sent
365
366
func handleAck( ack: Int , data: AnyObject ? ) {
366
- SocketLogger . log ( " Client: Handling ack: \( ack) with data: \( data) " , client: self )
367
+ SocketLogger . log ( " Handling ack: \( ack) with data: \( data) " , client: self )
367
368
368
369
self . ackHandlers. executeAck ( ack,
369
370
items: ( data as? [ AnyObject ] ? ) ?? ( data != nil ? [ data!] : nil ) )
@@ -379,7 +380,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
379
380
return
380
381
}
381
382
382
- SocketLogger . log ( " Client: Handling event: \( event) with data: \( data) " , client: self )
383
+ SocketLogger . log ( " Handling event: \( event) with data: \( data) " , client: self )
383
384
384
385
if self . anyHandler != nil {
385
386
dispatch_async ( dispatch_get_main_queue ( ) ) { [ weak self] in
@@ -399,7 +400,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
399
400
}
400
401
401
402
func joinNamespace( ) {
402
- SocketLogger . log ( " Client: Joining namespace" , client: self )
403
+ SocketLogger . log ( " Joining namespace " , client: self )
403
404
404
405
if self . nsp != " / " {
405
406
self . engine? . send ( " 0/ \( self . nsp) " , withData: nil )
@@ -410,7 +411,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
410
411
Removes handler(s)
411
412
*/
412
413
public func off( event: String ) {
413
- SocketLogger . log ( " Client: Removing handler for event: \( event) " , client: self )
414
+ SocketLogger . log ( " Removing handler for event: \( event) " , client: self )
414
415
415
416
self . handlers = self . handlers. filter { $0. event == event ? false : true }
416
417
}
@@ -419,7 +420,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
419
420
Adds a handler for an event.
420
421
*/
421
422
public func on( name: String , callback: NormalCallback ) {
422
- SocketLogger . log ( " Client: Adding handler for event: \( name) " , client: self )
423
+ SocketLogger . log ( " Adding handler for event: \( name) " , client: self )
423
424
424
425
let handler = SocketEventHandler ( event: name, callback: callback)
425
426
self . handlers. append ( handler)
@@ -468,7 +469,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
468
469
}
469
470
470
471
if self . reconnectTimer == nil {
471
- SocketLogger . log ( " Client: Starting reconnect" , client: self )
472
+ SocketLogger . log ( " Starting reconnect " , client: self )
472
473
473
474
self . _reconnecting = true
474
475
@@ -483,7 +484,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
483
484
}
484
485
}
485
486
486
- SocketLogger . log ( " Client: Trying to reconnect" , client: self )
487
+ SocketLogger . log ( " Trying to reconnect " , client: self )
487
488
self . handleEvent ( " reconnectAttempt " , data: [ self . reconnectAttempts - self . currentReconnectAttempt] ,
488
489
isInternalMessage: true )
489
490
0 commit comments