@@ -11,20 +11,20 @@ extension PusherConnection: WebSocketConnectionDelegate {
1111 - parameter string: The message received over the websocket
1212 */
1313 public func webSocketDidReceiveMessage( connection: WebSocketConnection , string: String ) {
14- PusherLogger . shared. debug ( for: . receivedMessage, context: string)
14+ Logger . shared. debug ( for: . receivedMessage, context: string)
1515
16- guard let payload = PusherParser . getPusherEventJSON ( from: string) ,
16+ guard let payload = EventParser . getPusherEventJSON ( from: string) ,
1717 let event = payload [ Constants . JSONKeys. event] as? String
1818 else {
19- PusherLogger . shared. debug ( for: . unableToHandleIncomingMessage,
20- context: string)
19+ Logger . shared. debug ( for: . unableToHandleIncomingMessage,
20+ context: string)
2121 return
2222 }
2323
2424 if event == Constants . Events. Pusher. error {
2525 guard let error = PusherError ( jsonObject: payload) else {
26- PusherLogger . shared. debug ( for: . unableToHandleIncomingError,
27- context: string)
26+ Logger . shared. debug ( for: . unableToHandleIncomingError,
27+ context: string)
2828 return
2929 }
3030 self . handleError ( error: error)
@@ -36,7 +36,7 @@ extension PusherConnection: WebSocketConnectionDelegate {
3636 /// Delegate method called when a pong is received over a websocket
3737 /// - Parameter connection: The websocket that has received the pong
3838 public func webSocketDidReceivePong( connection: WebSocketConnection ) {
39- PusherLogger . shared. debug ( for: . pongReceived)
39+ Logger . shared. debug ( for: . pongReceived)
4040 resetActivityTimeoutTimer ( )
4141 }
4242
@@ -64,7 +64,7 @@ extension PusherConnection: WebSocketConnectionDelegate {
6464 updateConnectionState ( to: . disconnected)
6565
6666 guard !intentionalDisconnect else {
67- PusherLogger . shared. debug ( for: . intentionalDisconnection)
67+ Logger . shared. debug ( for: . intentionalDisconnection)
6868 return
6969 }
7070
@@ -82,7 +82,7 @@ extension PusherConnection: WebSocketConnectionDelegate {
8282 }
8383
8484 guard reconnectAttemptsMax == nil || reconnectAttempts < reconnectAttemptsMax! else {
85- PusherLogger . shared. debug ( for: . maxReconnectAttemptsLimitReached)
85+ Logger . shared. debug ( for: . maxReconnectAttemptsLimitReached)
8686 return
8787 }
8888
@@ -91,9 +91,9 @@ extension PusherConnection: WebSocketConnectionDelegate {
9191
9292 public func webSocketViabilityDidChange( connection: WebSocketConnection , isViable: Bool ) {
9393 if isViable {
94- PusherLogger . shared. debug ( for: . networkConnectionViable)
94+ Logger . shared. debug ( for: . networkConnectionViable)
9595 } else {
96- PusherLogger . shared. debug ( for: . networkConnectionUnviable)
96+ Logger . shared. debug ( for: . networkConnectionUnviable)
9797 }
9898 }
9999
@@ -103,8 +103,8 @@ extension PusherConnection: WebSocketConnectionDelegate {
103103 updateConnectionState ( to: . reconnecting)
104104
105105 case . failure( let error) :
106- PusherLogger . shared. debug ( for: . errorReceived,
107- context: """
106+ Logger . shared. debug ( for: . errorReceived,
107+ context: """
108108 Path migration error: \( error. debugDescription)
109109 """ )
110110 }
@@ -128,9 +128,9 @@ extension PusherConnection: WebSocketConnectionDelegate {
128128
129129 // Reconnect attempt according to Pusher Channels Protocol close code (if present).
130130 // (Otherwise, the default behavior is to attempt reconnection after backing off).
131- var channelsCloseCode : PusherChannelsProtocolCloseCode ?
131+ var channelsCloseCode : ChannelsProtocolCloseCode ?
132132 if case let . privateCode( code) = closeCode {
133- channelsCloseCode = PusherChannelsProtocolCloseCode ( rawValue: code)
133+ channelsCloseCode = ChannelsProtocolCloseCode ( rawValue: code)
134134 }
135135 let strategy = channelsCloseCode? . reconnectionStrategy ?? . reconnectAfterBackingOff
136136
@@ -161,7 +161,7 @@ extension PusherConnection: WebSocketConnectionDelegate {
161161 /// Returns a `TimeInterval` appropriate for a reconnection attempt after some delay.
162162 /// - Parameter strategy: The reconnection strategy for the reconnection attempt.
163163 /// - Returns: An appropriate `TimeInterval`. (0.0 if `strategy == .reconnectImmediately`).
164- func reconnectionAttemptTimeInterval( strategy: PusherChannelsProtocolCloseCode . ReconnectionStrategy ) -> TimeInterval {
164+ func reconnectionAttemptTimeInterval( strategy: ChannelsProtocolCloseCode . ReconnectionStrategy ) -> TimeInterval {
165165 if case . reconnectImmediately = strategy {
166166 return 0.0
167167 }
@@ -174,10 +174,10 @@ extension PusherConnection: WebSocketConnectionDelegate {
174174
175175 /// Logs the websocket reconnection attempt.
176176 /// - Parameter strategy: The reconnection strategy for the reconnection attempt.
177- func logReconnectionAttempt( strategy: PusherChannelsProtocolCloseCode . ReconnectionStrategy ) {
177+ func logReconnectionAttempt( strategy: ChannelsProtocolCloseCode . ReconnectionStrategy ) {
178178
179179 var context = " (attempt \( reconnectAttempts + 1 ) ) "
180- var loggingEvent = PusherLogger . LoggingEvent. attemptReconnectionImmediately
180+ var loggingEvent = Logger . LoggingEvent. attemptReconnectionImmediately
181181
182182 if reconnectAttemptsMax != nil {
183183 context. insert ( contentsOf: " of \( reconnectAttemptsMax!) " , at: context. index ( before: context. endIndex) )
@@ -189,8 +189,8 @@ extension PusherConnection: WebSocketConnectionDelegate {
189189 context = " \( timeInterval) seconds " + context
190190 }
191191
192- PusherLogger . shared. debug ( for: loggingEvent,
193- context: context)
192+ Logger . shared. debug ( for: loggingEvent,
193+ context: context)
194194 }
195195
196196 /// Logs the websocket disconnection event.
@@ -218,8 +218,8 @@ extension PusherConnection: WebSocketConnectionDelegate {
218218 closeMessage += " Reason: \( reasonString) . "
219219 }
220220
221- PusherLogger . shared. debug ( for: . disconnectionWithoutError,
222- context: closeMessage)
221+ Logger . shared. debug ( for: . disconnectionWithoutError,
222+ context: closeMessage)
223223 }
224224
225225 /**
@@ -236,8 +236,8 @@ extension PusherConnection: WebSocketConnectionDelegate {
236236 }
237237
238238 public func webSocketDidReceiveError( connection: WebSocketConnection , error: NWError ) {
239- PusherLogger . shared. debug ( for: . errorReceived,
240- context: """
239+ Logger . shared. debug ( for: . errorReceived,
240+ context: """
241241 Error: \( error. debugDescription)
242242 """ )
243243 }
0 commit comments