pub struct WebSocketFactory<S = Unset> { /* private fields */ }Expand description
Factory that derives stock + futopt WebSocket endpoint configurations from a single authentication credential and an optional shared base URL.
The factory is generic over a typestate marker (Unset / WithAuth)
so the compiler enforces that .auth(...) is called before .stock()
/ .futopt().
Implementations§
Source§impl WebSocketFactory
impl WebSocketFactory
Sourcepub fn new() -> WebSocketFactory
pub fn new() -> WebSocketFactory
Create a fresh factory pointing at the production WebSocket base URL
(crate::urls::WS_BASE_ROOT). Returns a typestate-Unset
instance; chain auth before
stock / futopt.
Sourcepub fn auth(self, auth: AuthRequest) -> WebSocketFactory<WithAuth>
pub fn auth(self, auth: AuthRequest) -> WebSocketFactory<WithAuth>
Set the authentication credential, advancing the typestate to
WithAuth.
Source§impl<S> WebSocketFactory<S>
impl<S> WebSocketFactory<S>
Sourcepub fn base_url(self, base: impl Into<String>) -> WebSocketFactory<S>
pub fn base_url(self, base: impl Into<String>) -> WebSocketFactory<S>
Override the WebSocket base URL.
Available in any state. base MUST include the API version
segment (e.g. "wss://api.fugle.tw/marketdata/v1.0"). The factory
appends only /{stock|futopt}/streaming to whatever you pass;
it does NOT inject /{API_VERSION} for caller-supplied bases.
Trailing slashes are stripped.
§⚠️ Silent breaking change in 0.6.0
Pre-0.6.0 this method accepted a host root (no version) and the
factory silently appended /{API_VERSION}. As of 0.6.0 the
caller owns the full prefix, matching the OpenAI / Stripe / AWS
SDK convention. Code that worked in 0.5.x will compile against
0.6.0 but produce a 404 on first connect because the URL lacks
the /v1.0 segment. See MIGRATION-0.6.md.
Source§impl WebSocketFactory<WithAuth>
impl WebSocketFactory<WithAuth>
Sourcepub fn stock(&self) -> ConnectionConfigBuilder
pub fn stock(&self) -> ConnectionConfigBuilder
Derived stock-streaming endpoint as a ConnectionConfigBuilder.
Chain further setters (.message_buffer(...), etc.) then
.build() to obtain the ConnectionConfig. Only available once
auth(...) has been called.
Sourcepub fn futopt(&self) -> ConnectionConfigBuilder
pub fn futopt(&self) -> ConnectionConfigBuilder
Derived futures/options streaming endpoint as a
ConnectionConfigBuilder. Only available once auth(...) has
been called.
Trait Implementations§
Source§impl<S> Clone for WebSocketFactory<S>where
S: Clone,
impl<S> Clone for WebSocketFactory<S>where
S: Clone,
Source§fn clone(&self) -> WebSocketFactory<S>
fn clone(&self) -> WebSocketFactory<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more