pub struct WebSocketReadHalf { /* private fields */ }
Expand description
The read half of a WebSocket connection, generated from WebSocket::split()
.
This half can only receive frames.
Implementations§
Source§impl WebSocketReadHalf
impl WebSocketReadHalf
Sourcepub async fn receive(&mut self) -> Result<Frame, WebSocketError>
pub async fn receive(&mut self) -> Result<Frame, WebSocketError>
Receives a Frame
over the WebSocket connection.
If the received frame is a Ping frame, an event to send a Pong frame will be queued.
If the received frame is a Close frame, an event to send a Close frame
will be queued and the WebSocket will close. However, events are not
acted upon unless flushed (see the documentation on the WebSocket
type for more details).
Sourcepub async fn receive_without_handling(
&mut self,
) -> Result<Frame, WebSocketError>
pub async fn receive_without_handling( &mut self, ) -> Result<Frame, WebSocketError>
Receives a Frame
over the WebSocket connection without handling incoming frames.
For example, receiving a Ping frame will not queue a Pong frame to be sent,
and receiving a Close frame will not queue a Close frame to be sent nor close
the connection.
To automatically handle incoming frames, use the receive()
method instead.