Struct dtn7_plus::client::DtnWsConnection
source · [−]Implementations
sourceimpl<Stream> DtnWsConnection<Stream> where
Stream: Read + Write,
impl<Stream> DtnWsConnection<Stream> where
Stream: Read + Write,
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> 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> UnwindSafe for DtnWsConnection<Stream> where
Stream: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more