pub struct XdcSession { /* private fields */ }Expand description
A live realtime session. Dropping it leaves.
Implementations§
Source§impl XdcSession
impl XdcSession
Sourcepub async fn send(&self, payload: impl Into<Vec<u8>>) -> Result<(), String>
pub async fn send(&self, payload: impl Into<Vec<u8>>) -> Result<(), String>
Broadcast a frame to everyone on the channel, at most 128 000 bytes.
Like the app’s own send, delivery is best-effort and never echoes back.
Sourcepub async fn recv(&mut self) -> Option<XdcEvent>
pub async fn recv(&mut self) -> Option<XdcEvent>
The next event, or None once the session has ended.
Sourcepub fn npub_of(&self, node: &[u8; 32]) -> Option<String>
pub fn npub_of(&self, node: &[u8; 32]) -> Option<String>
Who a node speaks for, by the advertisement that first named it here.
Sourcepub fn mesh(&self) -> Arc<Mesh> ⓘ
pub fn mesh(&self) -> Arc<Mesh> ⓘ
The mesh the session runs on (see mesh::retire_if_idle).
Sourcepub async fn neighbor_count(&self) -> usize
pub async fn neighbor_count(&self) -> usize
How many nodes are directly connected to us on this topic.
Sourcepub fn sender(&self) -> XdcSender
pub fn sender(&self) -> XdcSender
A handle that sends on this session from another task; it stops working once the session is left.
Sourcepub fn finished(&self) -> impl Future<Output = ()> + Send + 'static
pub fn finished(&self) -> impl Future<Output = ()> + Send + 'static
Resolves once this session has fully left, departure signal included, however it ends (dropped, left, or torn down with its account).
Trait Implementations§
Source§impl Drop for XdcSession
impl Drop for XdcSession
Auto Trait Implementations§
impl !RefUnwindSafe for XdcSession
impl !UnwindSafe for XdcSession
impl Forget for XdcSession
impl Freeze for XdcSession
impl Move for XdcSession
impl Send for XdcSession
impl Sync for XdcSession
impl Unpin for XdcSession
impl UnsafeUnpin for XdcSession
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> 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