Skip to content
Merged
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
166 changes: 74 additions & 92 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,123 +1,105 @@
name: Build
on: [push, pull_request]

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
RUSTC_WRAPPER: "sccache"
RUSTFLAGS: -D warnings
SCCACHE_GHA_ENABLED: "true"

jobs:
nightly-clippy:
name: Nightly Clippy
nightly:
name: Nightly
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # For Clippy PR annotations
checks: write # For Clippy check status
env:
SCCACHE_GHA_CACHE_NAME: "nightly"
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Cache Cargo registry
uses: actions/cache@v5
- uses: actions/checkout@v6
- uses: mozilla-actions/sccache-action@v0.0.9
- uses: actions/cache@v5
with:
path: ~/.cargo/registry
path: |
~/.cargo/registry
~/.cargo/git
target/release/deps
target/debug/deps
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Cache Cargo build
uses: actions/cache@v5
- uses: dtolnay/rust-toolchain@nightly
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
components: clippy, rustfmt

- name: Set up Rust Nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
# Formatting check
- name: Check formatting
run: cargo fmt -- --check

- name: Run Clippy
run: cargo clippy -- -D warnings
# Tests
- name: Run Cargo Tests (default features)
run: cargo test

nightly-test:
name: Nightly Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Run Cargo Tests (all features)
run: cargo test --all-features

- name: Cache Cargo registry
uses: actions/cache@v5
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Run Cargo Tests (no features)
run: cargo test --no-default-features

- name: Cache Cargo build
uses: actions/cache@v5
# Clippy and post annotations
- name: Clippy Check
uses: giraffate/clippy-action@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-

- name: Set up Rust Nightly
uses: dtolnay/rust-toolchain@nightly

- name: Run Cargo Tests
run: cargo test --all-features
reporter: github-pr-review
github_token: ${{ secrets.GITHUB_TOKEN }}

stable-clippy:
name: Stable Clippy
stable:
name: Stable
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
checks: write
env:
SCCACHE_GHA_CACHE_NAME: "stable"
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Cache Cargo registry
uses: actions/cache@v5
- uses: actions/checkout@v6
- uses: mozilla-actions/sccache-action@v0.0.9
- uses: actions/cache@v5
with:
path: ~/.cargo/registry
path: |
~/.cargo/registry
~/.cargo/git
target/release/deps
target/debug/deps
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Cache Cargo build
uses: actions/cache@v5
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-

- name: Set up Rust Stable
uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Run Clippy
run: cargo clippy -- -D warnings
# Formatting check
- name: Check formatting
run: cargo fmt -- --check

stable-test:
name: Stable Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
# Tests
- name: Run Cargo Tests (default features)
run: cargo test

- name: Cache Cargo registry
uses: actions/cache@v5
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Cache Cargo build
uses: actions/cache@v5
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Run Cargo Tests (all features)
run: cargo test --all-features

- name: Set up Rust Stable
uses: dtolnay/rust-toolchain@stable
- name: Run Cargo Tests (no features)
run: cargo test --no-default-features

- name: Run Cargo Tests
run: cargo test --all-features
# Clippy and post annotations
- name: Clippy Check
uses: giraffate/clippy-action@v1
with:
reporter: github-pr-review
github_token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<!-- markdownlint-configure-file { "no-duplicate-heading": { "siblings_only": true } } -->

<!-- markdownlint-disable-next-line first-line-h1 -->
## 0.2.0 - Unreleased
## 0.2.0 - 2026-04-30

### Added

* Reconnect with callback installed via `WStompConfig::on_reconnect`.
The reconnect loop is then spawned by `WStompConfig::build_and_connect`,
which in the reconnecting state returns a `WStompReconnectHandle`
instead of a `WStompClient`.
* Certificate authentication - `connect_ssl_with_cert`.

## 0.1.0 - 2025-11-18

Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ Add this to your `Cargo.toml`:

```toml
[dependencies]
wstomp = "0.1.0" # Replace with the actual version
wstomp = "0.2"
actix-rt = "2.0"
```

For SSL support, enable the `rustls` feature:

```toml
[dependencies]
wstomp = { version = "0.1.0", features = ["rustls"] }
wstomp = { version = "0.2", features = ["rustls"] }
```

## Usage
Expand Down Expand Up @@ -146,7 +146,7 @@ use wstomp::connect_with_token;
#[actix_rt::main]
async fn main() {
let url = "ws://my-server.com/ws/websocket";
let token = "my-secret-jwt-token";
let token = "my-secret-token";

let client = connect_with_token(url, token)
.await
Expand All @@ -163,6 +163,8 @@ If you are connecting to a `wss://` endpoint and need SSL, use the `rustls` feat
These helpers are specially configured to force HTTP/1.1, which can be necessary for compatibility with some WebSocket servers (like those using SockJS).

```rust,no_run
# #[cfg(feature = "rustls")] {

// Make sure to enable the "rustls" feature in Cargo.toml
use wstomp::connect_ssl_with_pass;

Expand All @@ -179,6 +181,8 @@ async fn main() {
println!("Connected securely!");
// ... use client
}

# }
```

### Auto-reconnect
Expand Down
1 change: 0 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ impl<U, R> WStompConfig<U, R> {
self
}


/// Appends a list of custom headers to the connection configuration.
///
/// These headers will be included in the STOMP `CONNECT` frame.
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ mod stomp_handler;
#[cfg(feature = "rustls")]
mod connect_ssl;
#[cfg(feature = "rustls")]
pub use connect_ssl::{connect_ssl, connect_ssl_with_pass, connect_ssl_with_token, connect_ssl_with_cert};
pub use connect_ssl::{
connect_ssl, connect_ssl_with_cert, connect_ssl_with_pass, connect_ssl_with_token,
};

pub mod wstomp_event;
pub use wstomp_event::{WStompConnectError, WStompError, WStompEvent};
Expand Down
Loading