Rocket/contrib/ws
Benedikt Weber 1f06bb0b73 Allow status customization in 'Forward' outcomes.
Prior to this commit, all forward outcomes resulted in a 404. This
commit changes request and data guards so that they are able to provide
a `Status` on `Forward` outcomes. The router uses this status, if the
final outcome is to forward, to identify the catcher to invoke.

The net effect is that guards can now customize the status code of a
forward and thus the error catcher invoked if the final outcome of a
request is to forward.

Resolves #1560.
2023-05-05 18:21:17 -07:00
..
src Allow status customization in 'Forward' outcomes. 2023-05-05 18:21:17 -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

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.