Rocket/contrib/ws
2023-04-05 09:58:21 -07:00
..
src Fix links to 'Stream!' in 'ws' rustdocs. 2023-04-05 09:58:21 -07:00
Cargo.toml Add initial implementation of 'rocket_ws'. 2023-04-01 15:02:24 -07:00
README.md Fix contrib 'ws' README formatting. 2023-04-04 15:37:22 -07:00

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.