pub struct ConnectOptions {
pub accept_version: Option<String>,
pub client_id: Option<String>,
pub host: Option<String>,
pub headers: Vec<(String, String)>,
}Expand description
Options for customizing the STOMP CONNECT frame.
Use this struct with Connection::connect_with_options() to set custom
headers, specify supported STOMP versions, or configure broker-specific
options like client-id for durable subscriptions.
§Validation
This struct performs minimal validation. Values are passed to the broker as-is, and invalid configurations will be rejected by the broker at connection time. Empty strings are technically accepted but may cause broker-specific errors.
§Custom Headers
Custom headers added via header() cannot override critical STOMP headers
(accept-version, host, login, passcode, heart-beat, client-id).
Such headers are silently ignored. Use the dedicated builder methods to
set these values.
§Example
use iridium_stomp::{Connection, ConnectOptions};
let options = ConnectOptions::default()
.client_id("my-durable-client")
.host("my-vhost")
.header("custom-header", "value");
let conn = Connection::connect_with_options(
"localhost:61613",
"guest",
"guest",
"10000,10000",
options,
).await?;Fields§
§accept_version: Option<String>STOMP version(s) to accept (e.g., “1.2” or “1.0,1.1,1.2”). Defaults to “1.2” if not set.
client_id: Option<String>Client ID for durable subscriptions (required by ActiveMQ, etc.).
host: Option<String>Virtual host header value. Defaults to “/” if not set.
headers: Vec<(String, String)>Additional custom headers to include in the CONNECT frame. Note: Headers that would override critical STOMP headers are ignored.
Implementations§
Source§impl ConnectOptions
impl ConnectOptions
Sourcepub fn accept_version(self, version: impl Into<String>) -> Self
pub fn accept_version(self, version: impl Into<String>) -> Self
Set the STOMP version(s) to accept (builder style).
Examples: “1.2”, “1.1,1.2”, “1.0,1.1,1.2”
Sourcepub fn client_id(self, id: impl Into<String>) -> Self
pub fn client_id(self, id: impl Into<String>) -> Self
Set the client ID for durable subscriptions (builder style).
Required by some brokers (e.g., ActiveMQ) for durable topic subscriptions.
Trait Implementations§
Source§impl Clone for ConnectOptions
impl Clone for ConnectOptions
Source§fn clone(&self) -> ConnectOptions
fn clone(&self) -> ConnectOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more