pub struct RelayClient { /* private fields */ }Expand description
A native relay client — and the reference for what the browser does over
web-sys WebSocket with the same RelayFrame protocol.
Implementations§
Source§impl RelayClient
impl RelayClient
Sourcepub async fn connect(url: &str) -> Result<RelayClient, String>
pub async fn connect(url: &str) -> Result<RelayClient, String>
Dial a relay at url (ws://host:port).
Sourcepub async fn subscribe(&mut self, topic: &str) -> Result<(), String>
pub async fn subscribe(&mut self, topic: &str) -> Result<(), String>
Subscribe to topic and await the relay’s acknowledgement, so a
subsequent publish from anyone cannot race ahead of the registration.
Auto Trait Implementations§
impl Freeze for RelayClient
impl RefUnwindSafe for RelayClient
impl Send for RelayClient
impl Sync for RelayClient
impl Unpin for RelayClient
impl UnsafeUnpin for RelayClient
impl UnwindSafe for RelayClient
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