Skip to content

Commit c6f0859

Browse files
committed
Add 'attemptReconnectionAfterWaiting' event handling to 'PusherLogger'.
1 parent a522953 commit c6f0859

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Sources/PusherLogger.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ internal class PusherLogger {
2626
// Websockets
2727

2828
case attemptReconnectionAfterReachabilityChange = "Connection state is 'connected' but received network reachability change so going to call attemptReconnect"
29+
case attemptReconnectionAfterWaiting = "Attempting to reconnect after waiting"
2930
case connectionEstablished = "Socket established with socket ID:"
3031
case disconnectionWithError = "Websocket is disconnected."
3132
case disconnectionWithoutError = "Websocket is disconnected but no error received"

Sources/PusherWebsocketDelegate.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,13 @@ extension PusherConnection: WebSocketDelegate {
104104
: reconnectInterval
105105

106106
if reconnectAttemptsMax != nil {
107-
self.delegate?.debugLog?(message: "[PUSHER DEBUG] Waiting \(timeInterval) seconds before attempting to reconnect (attempt \(reconnectAttempts + 1) of \(reconnectAttemptsMax!))")
107+
let message = PusherLogger.debug(for: .attemptReconnectionAfterWaiting,
108+
context: "\(timeInterval) seconds (attempt \(reconnectAttempts + 1) of \(reconnectAttemptsMax!))")
109+
self.delegate?.debugLog?(message: message)
108110
} else {
109-
self.delegate?.debugLog?(message: "[PUSHER DEBUG] Waiting \(timeInterval) seconds before attempting to reconnect (attempt \(reconnectAttempts + 1))")
111+
let message = PusherLogger.debug(for: .attemptReconnectionAfterWaiting,
112+
context: "\(timeInterval) seconds (attempt \(reconnectAttempts + 1))")
113+
self.delegate?.debugLog?(message: message)
110114
}
111115

112116
reconnectTimer = Timer.scheduledTimer(

0 commit comments

Comments
 (0)