pub struct NetworkHandle { /* private fields */ }Implementations§
Source§impl NetworkHandle
impl NetworkHandle
Sourcepub fn attach_server(&self, client: ServerClient)
pub fn attach_server(&self, client: ServerClient)
Attach a live server connection so subsequent room traffic mirrors to it. Replaces any previous one. Called by the app’s server connection task after each (re)connect.
Sourcepub fn detach_server(&self)
pub fn detach_server(&self)
Drop the server connection (e.g. after a disconnect) so we stop mirroring until it reconnects.
pub async fn subscribe_room(&self, room_id: String)
pub async fn unsubscribe_room(&self, room_id: String)
pub async fn publish_room_message(&self, room_id: String, payload: Vec<u8>)
pub async fn announce_room(&self, ann: RoomAnnouncement)
Sourcepub fn has_server(&self) -> bool
pub fn has_server(&self) -> bool
True when a server connection is currently attached.
pub async fn dial(&self, address: Multiaddr)
Sourcepub async fn dial_addresses(&self, addresses: Vec<Multiaddr>)
pub async fn dial_addresses(&self, addresses: Vec<Multiaddr>)
huddle 0.5.2: dial a peer with multiple candidate addresses at once. libp2p’s swarm races them; the first to complete a handshake wins, the rest are dropped. Use when you’ve resolved a peer fingerprint to several known transports — typically LAN ip4 + public ip4 + relay circuit.
pub async fn accept_inbound(&self, peer_id: PeerId)
pub async fn reject_inbound(&self, peer_id: PeerId)
pub async fn disconnect_peer(&self, peer_id: PeerId)
pub async fn shutdown(&self)
Trait Implementations§
Source§impl Clone for NetworkHandle
impl Clone for NetworkHandle
Source§fn clone(&self) -> NetworkHandle
fn clone(&self) -> NetworkHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NetworkHandle
impl RefUnwindSafe for NetworkHandle
impl Send for NetworkHandle
impl Sync for NetworkHandle
impl Unpin for NetworkHandle
impl UnsafeUnpin for NetworkHandle
impl UnwindSafe for NetworkHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more