diff --git a/axum/src/extract/ws.rs b/axum/src/extract/ws.rs index 2eb3b2af..d9e7adcd 100644 --- a/axum/src/extract/ws.rs +++ b/axum/src/extract/ws.rs @@ -549,11 +549,22 @@ impl WebSocket { /// Receive another message. /// /// Returns `None` if the stream has closed. + /// + /// This method delegates to [`Stream`]. + /// + /// # Cancel safety + /// + /// This method is cancel safe. If used as a branch in [`tokio::select!`] and + /// another branch completes first, then no message is received. + /// + /// [`tokio::select!`]: https://docs.rs/tokio/latest/tokio/macro.select.html pub async fn recv(&mut self) -> Option> { self.next().await } /// Send a message. + /// + /// This method delegates to [`Sink`]. pub async fn send(&mut self, msg: Message) -> Result<(), Error> { self.inner .send(msg.into_tungstenite())