pub struct WebsocketClient<SE, PA>{ /* private fields */ }Expand description
A WebSocket client for connecting Ankurah nodes
Implementations§
Source§impl<SE, PA> WebsocketClient<SE, PA>
impl<SE, PA> WebsocketClient<SE, PA>
Sourcepub async fn new(node: Node<SE, PA>, server_url: &str) -> Result<Self>
pub async fn new(node: Node<SE, PA>, server_url: &str) -> Result<Self>
Create a new WebSocket client and start connecting to the server
Sourcepub fn state(&self) -> Read<ConnectionState>
pub fn state(&self) -> Read<ConnectionState>
Get the connection state as a reactive signal
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if currently connected to the server
Sourcepub async fn wait_connected(&self) -> Result<(), ConnectionError>
pub async fn wait_connected(&self) -> Result<(), ConnectionError>
Wait for the client to establish a connection to the server (signal-based)
Sourcepub fn server_node_id(&self) -> Option<EntityId>
pub fn server_node_id(&self) -> Option<EntityId>
Get the node ID of the connected server (if connected)
Trait Implementations§
Source§impl<SE, PA> Drop for WebsocketClient<SE, PA>
impl<SE, PA> Drop for WebsocketClient<SE, PA>
Auto Trait Implementations§
impl<SE, PA> !Freeze for WebsocketClient<SE, PA>
impl<SE, PA> !RefUnwindSafe for WebsocketClient<SE, PA>
impl<SE, PA> Send for WebsocketClient<SE, PA>
impl<SE, PA> Sync for WebsocketClient<SE, PA>
impl<SE, PA> Unpin for WebsocketClient<SE, PA>
impl<SE, PA> !UnwindSafe for WebsocketClient<SE, PA>
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