Crates.io | rocket_ws |
lib.rs | rocket_ws |
version | 0.1.1 |
source | src |
created_at | 2023-11-02 00:52:05.082643 |
updated_at | 2024-05-23 20:35:48.796705 |
description | WebSocket support for Rocket. |
homepage | https://rocket.rs |
repository | https://github.com/rwf2/Rocket/tree/v0.5/contrib/ws |
max_upload_size | |
id | 1022034 |
size | 38,119 |
ws
This crate provides WebSocket support for Rocket via integration with Rocket's [connection upgrades] API.
Depend on rocket_ws
, renamed here to ws
:
[dependencies]
ws = { package = "rocket_ws", version = "0.1.1" }
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.