Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Built-in WebSocket support behind rkt's optional `ws` feature, available as
`rkt::ws`. The `rkt_ws` crate remains a deprecated compatibility shim for one
full minor release cycle.
- Support for the [PROXY protocol] (v1 and v2) behind the new `proxy-proto`
crate feature. Setting the `proxy_protocol` configuration option (env
`ROCKET_PROXY_PROTOCOL`) to `true` requires every connection to begin with a
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ members = [
]

[workspace.package]
version = "1.2.0"
version = "1.3.0"
authors = ["Sergio Benitez <sb@sergio.bz>"]
license = "MIT OR Apache-2.0"
edition = "2021"
Expand All @@ -20,9 +20,9 @@ repository = "https://github.com/rustfoo/rkt"
readme = "README.md"

[workspace.dependencies]
rkt = { version = "1.2.0", path = "core/lib/", default-features = false }
rkt_http = { version = "1.2.0", path = "core/http/" }
rkt_codegen = { version = "1.2.0", path = "core/codegen/" }
rkt = { version = "1.3.0", path = "core/lib/", default-features = false }
rkt_http = { version = "1.3.0", path = "core/http/" }
rkt_codegen = { version = "1.3.0", path = "core/codegen/" }

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(nightly)'] }
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Add `rkt` to your `Cargo.toml`:

```toml
[dependencies]
rkt = "1.2.0"
rkt = "1.3.0"
```

## Crates
Expand All @@ -45,15 +45,14 @@ rkt = "1.2.0"
|-------|-------------|------|
| `rkt` | Core framework | [![docs.rs](https://img.shields.io/docsrs/rkt)](https://docs.rs/rkt) |
| `rkt_dyn_templates` | Dynamic template rendering (Tera, Handlebars, MiniJinja) | [![docs.rs](https://img.shields.io/docsrs/rkt_dyn_templates)](https://docs.rs/rkt_dyn_templates) |
| `rkt_ws` | WebSocket support | [![docs.rs](https://img.shields.io/docsrs/rkt_ws)](https://docs.rs/rkt_ws) |

## Features

- **HTTP/1.1 & HTTP/2** — built on Hyper
- **HTTP/3 preview** — via s2n-quic (enable with `http3-preview`)
- **TLS & mTLS** — via Rustls (enable with `tls` / `mtls`)
- **Secret cookies** — signed and encrypted cookie support (enable with `secrets`)
- **WebSockets** — first-class support via `rkt_ws`
- **WebSockets** — first-class support via `rkt::ws` (enable with `ws`)
- **Dynamic templates** — Tera, Handlebars, and MiniJinja via `rkt_dyn_templates`
- **Tracing** — structured logging via the `tracing` ecosystem
- **Type-safe routing** — compile-time checked routes, guards, and responders
Expand Down
2 changes: 1 addition & 1 deletion contrib/dyn_templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ and automatically reloads templates when compiled in debug mode. It supports [Ha

```toml
[dependencies.rkt_dyn_templates]
version = "1.2.0"
version = "1.3.0"
features = ["handlebars", "tera", "minijinja"]
```

Expand Down
10 changes: 3 additions & 7 deletions contrib/ws/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "rkt_ws"
version.workspace = true
authors.workspace = true
description = "WebSocket support for rkt."
description = "Deprecated compatibility shim for rkt WebSocket support."
documentation = "https://docs.rs/rkt_ws/latest/rkt_ws/"
homepage.workspace = true
repository.workspace = true
Expand All @@ -17,14 +17,10 @@ workspace = true

[features]
default = ["tungstenite"]
tungstenite = ["tokio-tungstenite"]
tungstenite = []

[dependencies]
tokio-tungstenite = { version = "0.30", optional = true }

[dependencies.rkt]
workspace = true
default-features = false
rkt = { workspace = true, default-features = false, features = ["ws"] }

[package.metadata.docs.rs]
all-features = true
43 changes: 13 additions & 30 deletions contrib/ws/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@
# `ws` [![ci.svg]][ci] [![crates.io]][crate] [![docs.svg]][crate docs]
# `rkt_ws` (deprecated)

[crates.io]: https://img.shields.io/crates/v/rkt_ws.svg
[crate]: https://crates.io/crates/rkt_ws
[docs.svg]: https://img.shields.io/badge/web-master-red.svg?style=flat&label=docs&colorB=d33847
[crate docs]: https://docs.rs/rkt_ws/latest/rkt_ws/
[ci.svg]: https://github.com/rustfoo/rkt/workflows/CI/badge.svg
[ci]: https://github.com/rustfoo/rkt/actions
WebSocket support now lives in [`rkt::ws`](https://docs.rs/rkt/latest/rkt/ws/).

This crate provides WebSocket support for rkt via integration with rkt's
[connection upgrades] API.
```toml
[dependencies]
rkt = { version = "1.3.0", features = ["ws"] }
```

# Usage
Replace `rkt_ws` or `ws` imports with `rkt::ws`:

1. Depend on `rkt_ws`, renamed here to `ws`:
```rust
use rkt::ws::{WebSocket, Stream};
```

```toml
[dependencies]
ws = { package = "rkt_ws", version = "1.2.0" }
```

2. Use it!

```rust
#[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.
`rkt_ws` remains a source-compatible compatibility shim for one full minor
release cycle and will be removed in the following minor release. Its legacy
`tungstenite` feature remains a no-op compatibility alias.
Loading
Loading