damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 71bb9d6c92ce9b720c2d3860c8a91c5df59bbb77
parent 271e3ad54a9d94d2ba38a7d9c1f8b085a5596bc7
Author: Bryan Montz <bryanmontz@me.com>
Date:   Thu,  8 Jun 2023 06:44:47 -0500

Add text description to WebSocket for state logging

Diffstat:
Mdamus/Nostr/WebSocket.swift | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/damus/Nostr/WebSocket.swift b/damus/Nostr/WebSocket.swift @@ -13,6 +13,19 @@ enum WebSocketEvent { case message(URLSessionWebSocketTask.Message) case disconnected(URLSessionWebSocketTask.CloseCode, String?) case error(Error) + + var description: String? { + switch self { + case .connected: + return "Connected" + case .message(_): + return "Received message" + case .disconnected(let close_code, let reason): + return "Disconnected: Close code: \(close_code), reason: \(reason ?? "unknown")" + case .error(let error): + return "Error: \(error)" + } + } } final class WebSocket: NSObject, URLSessionWebSocketDelegate {