Rocket/contrib/ws
Lev Kokotov 9eac525e7d Fix typo in 'rocket_ws' README. 2023-10-26 20:01:06 -05:00
..
src Allow status customization in 'Forward' outcomes. 2023-05-05 18:21:17 -07:00
Cargo.toml Upgrade 'tokio-tungstenite' to 0.20. 2023-10-26 20:01:06 -05:00
README.md Fix typo in 'rocket_ws' README. 2023-10-26 20:01:06 -05:00

README.md

ws ci.svg crates.io docs.svg

This crate provides WebSocket support for Rocket via integration with Rocket's [connection upgrades] API.

Usage

  1. Depend on rocket_ws, renamed here to ws:

    [dependencies]
    ws = { package = "rocket_ws", version ="=0.1.0-rc.3" }
    
  2. Use it!

    #[get("/echo")]
    fn echo_stream(ws: ws::WebSocket) -> ws::Stream!['static] {
        ws::Stream! { ws =>
            for await message in ws {
                yield message?;
            }
        }
    }
    

See the crate docs for full details.