pub struct WebsocketSourceConfig {Show 14 fields
pub url: String,
pub auth: AuthSpec<WebsocketAuth>,
pub subscribe_messages: Vec<String>,
pub message_format: WsMessageFormat,
pub on_parse_error: OnParseError,
pub envelope: bool,
pub ping_interval: Option<Duration>,
pub max_messages: Option<usize>,
pub idle_timeout: Option<Duration>,
pub reconnect: bool,
pub reconnect_backoff: Duration,
pub max_reconnect_attempts: Option<usize>,
pub max_message_bytes: Option<usize>,
pub batch_size: usize,
}Expand description
Configuration for the WebSocket source.
Fields§
§url: StringWebSocket endpoint, ws:// or wss://. Supports {placeholder}
parent-matrix context substitution.
auth: AuthSpec<WebsocketAuth>Authentication applied to the HTTP upgrade request. Either inline
({ type, config }) or a { ref: <name> } pointer to a shared
provider in the CLI’s top-level auth: catalog.
subscribe_messages: Vec<String>Subscription frames sent (in order) immediately after every (re)connect. Empty = send nothing.
message_format: WsMessageFormatHow to interpret each incoming frame.
on_parse_error: OnParseErrorIn Json mode, what to do when a frame is not valid JSON.
envelope: boolfalse (default) emits the record raw; true wraps it as
{ data, received_at, url }.
ping_interval: Option<Duration>If set, send a WebSocket Ping frame on this interval (seconds) to keep the connection alive through proxies/load balancers.
max_messages: Option<usize>Stop after this many messages. At least one of max_messages /
idle_timeout must be set.
idle_timeout: Option<Duration>Stop after this many seconds with no message. The idle clock keeps ticking across reconnect gaps, so it also caps a connection outage.
reconnect: boolReconnect on transport error / non-1000 close.
reconnect_backoff: DurationFixed wait (seconds) between reconnect attempts. Default 1s.
max_reconnect_attempts: Option<usize>Cap on consecutive failed reconnects (resets on any received
message). None = unlimited (then idle_timeout is the natural cap).
max_message_bytes: Option<usize>Bound the max WebSocket message/frame size (bytes) to prevent runaway
memory. None = tungstenite default (64 MiB message / 16 MiB frame).
batch_size: usizeRecords per emitted StreamPage. Default
DEFAULT_BATCH_SIZE. 0 drains the entire run window into a single
page (same sentinel as the Kafka source).
Implementations§
Source§impl WebsocketSourceConfig
impl WebsocketSourceConfig
Sourcepub fn validate(&self) -> Result<(), FaucetError>
pub fn validate(&self) -> Result<(), FaucetError>
Validate the config at construction time. Called by WebsocketSource::new.
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Set the per-page record count for
Source::stream_pages. Pass 0 to
drain the entire run window into a single page.
Trait Implementations§
Source§impl Clone for WebsocketSourceConfig
impl Clone for WebsocketSourceConfig
Source§fn clone(&self) -> WebsocketSourceConfig
fn clone(&self) -> WebsocketSourceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WebsocketSourceConfig
impl Debug for WebsocketSourceConfig
Source§impl<'de> Deserialize<'de> for WebsocketSourceConfig
impl<'de> Deserialize<'de> for WebsocketSourceConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for WebsocketSourceConfig
impl JsonSchema for WebsocketSourceConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more