Browse Source

Minor changes in the client crate

Cesar Rodas 3 months ago
parent
commit
ad0f555ad6
1 changed files with 8 additions and 0 deletions
  1. 8 0
      crates/client/src/client.rs

+ 8 - 0
crates/client/src/client.rs

@@ -51,10 +51,13 @@ pub struct Client {
     /// relayer
     pub send_to_socket: mpsc::Sender<Request>,
 
+    /// List of active subscriptions for this nostr client
     subscriptions: Subscriptions,
 
+    /// Background task / thread that is doing the actual connection
     worker: JoinHandle<()>,
 
+    /// Wether the background worker is connected or not
     is_connected: Arc<AtomicBool>,
 }
 
@@ -91,6 +94,11 @@ impl Client {
         }
     }
 
+    /// Spawns a background client that connects to the relayer
+    /// and sends messages to the listener
+    ///
+    /// This function will return a JoinHandle that can be used to
+    /// wait for the background client to finish or to cancel it.
     fn spawn_background_client(
         send_message_to_listener: mpsc::Sender<(Response, Url)>,
         mut send_to_socket: mpsc::Receiver<Request>,