Add support for websockets (#3)

Basically a copy/paste of whats in warp.

Example usage:

```rust
use tower_web::{prelude::*, ws::{ws, WebSocket}};

let app = route("/ws", ws(handle_socket));

async fn handle_socket(mut socket: WebSocket) {
    while let Some(msg) = socket.recv().await {
        let msg = msg.unwrap();
        socket.send(msg).await.unwrap();
    }
}
```
This commit is contained in:
David Pedersen
2021-06-12 20:50:30 +02:00
committed by GitHub
parent 002e3f92b3
commit c9c507aece
9 changed files with 518 additions and 2 deletions
+4
View File
@@ -610,6 +610,10 @@ pub mod response;
pub mod routing;
pub mod service;
#[cfg(feature = "ws")]
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
pub mod ws;
#[cfg(test)]
mod tests;