Rocket/contrib/ws
Sergio Benitez 9544715103 Update 'tungstenite' to '0.21'. 2024-01-17 21:53:12 -08:00
..
src Fix min dependency versions. Update MSRV to 1.64. 2024-01-17 21:42:08 -08:00
Cargo.toml Update 'tungstenite' to '0.21'. 2024-01-17 21:53:12 -08:00
README.md Update 'SergioBenitez/Rocket' to 'rwf2/Rocket'. 2023-11-22 21:41:51 +01: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" }
    
  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.