Skip to content

Commit 06772b8

Browse files
committed
Add additional logging
1 parent d628dbf commit 06772b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/SignalRClient/WebsocketsTransport.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class WebsocketsTransport: NSObject, Transport, URLSessionWebSocketDelega
4747
}
4848

4949
public func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didOpenWithProtocol protocol: String?) {
50-
logger.log(logLevel: .info, message: "WebSocket open")
50+
logger.log(logLevel: .info, message: "urlSession didOpenWithProtocol invoked. WebSocket open")
5151
delegate?.transportDidOpen()
5252
readMessage()
5353
}
@@ -92,7 +92,9 @@ public class WebsocketsTransport: NSObject, Transport, URLSessionWebSocketDelega
9292
}
9393

9494
public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
95+
logger.log(logLevel: .debug, message: "urlSession didCompleteWithError invoked")
9596
guard error != nil else {
97+
logger.log(logLevel: .debug, message: "error is nil - ignoring error")
9698
// As per docs: "Error may be nil, which implies that no error occurred and this task is complete."
9799
return
98100
}
@@ -109,6 +111,7 @@ public class WebsocketsTransport: NSObject, Transport, URLSessionWebSocketDelega
109111
}
110112

111113
public func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didCloseWith closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) {
114+
logger.log(logLevel: .debug, message: "urlSession didCloseWith invoked")
112115
var reasonString = ""
113116
if let reason = reason {
114117
reasonString = String(decoding: reason, as: UTF8.self)

0 commit comments

Comments
 (0)