ensure relay connection

This commit is contained in:
2026-03-14 15:17:11 +07:00
parent 0d6aec2421
commit 739088b669
4 changed files with 115 additions and 26 deletions

View File

@@ -105,12 +105,17 @@ impl ChatRegistry {
subscriptions.push(
// Subscribe to the signer event
cx.subscribe(&nostr, |this, _state, event, cx| {
if let StateEvent::SignerSet = event {
this.reset(cx);
this.get_rooms(cx);
this.get_contact_list(cx);
this.get_messages(cx)
}
match event {
StateEvent::SignerSet => {
this.reset(cx);
this.get_rooms(cx);
}
StateEvent::RelayConnected => {
this.get_contact_list(cx);
this.get_messages(cx)
}
_ => {}
};
}),
);
@@ -332,6 +337,7 @@ impl ChatRegistry {
while let Some((_url, res)) = stream.next().await {
if let Ok(event) = res {
log::debug!("Got event: {:?}", event);
let urls: Vec<RelayUrl> = nip17::extract_owned_relay_list(event).collect();
return Ok(urls);
}