pub enum WsFrame {
Text(String),
Binary(Vec<u8>),
Ping(Vec<u8>),
Pong(Vec<u8>),
Close(CloseData),
}
Expand description
enumerates the different websocket message types
Variants§
Text(String)
utf8 text
Binary(Vec<u8>)
a string of bytes
Ping(Vec<u8>)
a ping message, content must be < 125 bytes
Pong(Vec<u8>)
a pong message, content must be < 125 bytes
Close(CloseData)
a close message, with a websocket close code https://www.iana.org/assignments/websocket/websocket.xml#close-code-number
Implementations§
Trait Implementations§
Source§impl<Sub: InStreamStd> InStream<&mut WsFrame, WsFrame> for InStreamWss<Sub>
impl<Sub: InStreamStd> InStream<&mut WsFrame, WsFrame> for InStreamWss<Sub>
Source§const URL_SCHEME: &'static str = SCHEME
const URL_SCHEME: &'static str = SCHEME
your implementation should work with a single url scheme/protocol
if you need to support multiple (i.e. ws:// vs wss://) consider
using macros/code generation to DRY
Source§fn raw_connect<C: InStreamConfig>(url: &Url2, config: C) -> Result<Self>
fn raw_connect<C: InStreamConfig>(url: &Url2, config: C) -> Result<Self>
create a new connection / stream of this type.
this function does the actual work of connecting, but it is recommended
your struct provide a wrapper with a concrete config type
Source§fn check_ready(&mut self) -> Result<bool>
fn check_ready(&mut self) -> Result<bool>
process the stream to see if any remaining handshake items can be completed
returns
true
if stream is set-up and ready to send/receive
note that you can write before this function returns true
but your messages may be buffered / sent laterSource§fn remote_url(&self) -> Url2
fn remote_url(&self) -> Url2
access the remote url this connection represents
Source§fn read(&mut self, data: &mut WsFrame) -> Result<usize>
fn read(&mut self, data: &mut WsFrame) -> Result<usize>
non-blocking read.
if R is an array-type, success result is number of elements read
otherwise it is 1
Source§impl<Sub: InStreamListenerStd> InStreamListener<&mut WsFrame, WsFrame> for InStreamListenerWss<Sub>
impl<Sub: InStreamListenerStd> InStreamListener<&mut WsFrame, WsFrame> for InStreamListenerWss<Sub>
type Stream = InStreamWss<<Sub as InStreamListenerStd>::StreamStd>
Auto Trait Implementations§
impl Freeze for WsFrame
impl RefUnwindSafe for WsFrame
impl Send for WsFrame
impl Sync for WsFrame
impl Unpin for WsFrame
impl UnwindSafe for WsFrame
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