|
@@ -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>,
|