mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-10 19:49:06 +00:00
7d895eb9f6
This provides WebSocket support in Rocket's official 'contrib'.
1000 B
1000 B
ws
This crate provides WebSocket support for Rocket via integration with Rocket's [connection upgrades] API.
Usage
-
Depend on
rocket_ws
, renamed here tows
:[dependencies] ws = { package = "rocket_ws", version ="=0.1.0-rc.3" }
-
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.