Note multicasting
This is an initial implementation of note multicast, which sends posted notes to other notedecks on the same network. This came about after I nerd sniped myself thinking about p2p nostr on local networks[1] You can test this exclusively without joining any other relays by passing -r multicast on the command line. [1] https://damus.io/note1j50pseqwma38g3aqrsnhvld0m0ysdgppw6fjnvvcj0haeulgswgq80lpca Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -10,7 +10,7 @@ use nostrdb::{Config, Ndb, Transaction};
|
||||
use std::cell::RefCell;
|
||||
use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
use tracing::info;
|
||||
use tracing::{error, info};
|
||||
|
||||
/// Our browser app state
|
||||
pub struct Notedeck {
|
||||
@@ -182,7 +182,13 @@ impl Notedeck {
|
||||
}
|
||||
|
||||
// AccountManager will setup the pool on first update
|
||||
let pool = RelayPool::new();
|
||||
let mut pool = RelayPool::new();
|
||||
{
|
||||
let ctx = ctx.clone();
|
||||
if let Err(err) = pool.add_multicast_relay(move || ctx.request_repaint()) {
|
||||
error!("error setting up multicast relay: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
let img_cache = ImageCache::new(imgcache_dir);
|
||||
let note_cache = NoteCache::default();
|
||||
|
||||
Reference in New Issue
Block a user