pub struct DtnWsConnection<Stream>{ /* private fields */ }Implementations§
Source§impl<Stream> DtnWsConnection<Stream>
impl<Stream> DtnWsConnection<Stream>
Sourcepub fn write_text(&mut self, txt: &str) -> Result<()>
pub fn write_text(&mut self, txt: &str) -> Result<()>
Send a text message via websocket
accepted commands:
/data
/bundle
/subscribe <service>
Sourcepub fn write_binary(&mut self, bin: &[u8]) -> Result<()>
pub fn write_binary(&mut self, bin: &[u8]) -> Result<()>
Send a binary message via websocket
Server expects either
- a valid bundle (in bundle mode)
- a WsSendData struct as a cbor buffer (in data mode)
Sourcepub fn read_message(&mut self) -> Result<Message>
pub fn read_message(&mut self) -> Result<Message>
Read the next message
Could be text, binary, ping, etc etc
Sourcepub fn read_text(&mut self) -> Result<String>
pub fn read_text(&mut self) -> Result<String>
Expect a text message next, returning an error on any other message type
Sourcepub fn read_binary(&mut self) -> Result<Vec<u8>>
pub fn read_binary(&mut self) -> Result<Vec<u8>>
Expect a binary message next, returning an error on any other message type
Auto Trait Implementations§
impl<Stream> Freeze for DtnWsConnection<Stream>where
Stream: Freeze,
impl<Stream> RefUnwindSafe for DtnWsConnection<Stream>where
Stream: RefUnwindSafe,
impl<Stream> Send for DtnWsConnection<Stream>where
Stream: Send,
impl<Stream> Sync for DtnWsConnection<Stream>where
Stream: Sync,
impl<Stream> Unpin for DtnWsConnection<Stream>where
Stream: Unpin,
impl<Stream> UnsafeUnpin for DtnWsConnection<Stream>where
Stream: UnsafeUnpin,
impl<Stream> UnwindSafe for DtnWsConnection<Stream>where
Stream: UnwindSafe,
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