pub struct StandardWebSocketClient { /* private fields */ }Expand description
FMP’s current native WebSocket connector for approved market streams.
The current FMP documentation
publishes wss://socket.financialmodelingprep.com and requires approved
declaration forms for direct streaming. Each stream must be explicitly
declared through StreamEntitlements; a billing plan alone grants none.
Authentication is confirmed using the documented nested login response.
Implementations§
Source§impl StandardWebSocketClient
impl StandardWebSocketClient
Sourcepub async fn connect(
api_key: &str,
subscription: &Subscription,
entitlements: StreamEntitlements,
config: StreamConfig,
) -> Result<Self, WebSocketError>
pub async fn connect( api_key: &str, subscription: &Subscription, entitlements: StreamEntitlements, config: StreamConfig, ) -> Result<Self, WebSocketError>
Connects to the current native endpoint and waits for confirmed login.
Sourcepub async fn connect_to(
api_key: &str,
subscription: &Subscription,
entitlements: StreamEntitlements,
endpoint: Url,
config: StreamConfig,
) -> Result<Self, WebSocketError>
pub async fn connect_to( api_key: &str, subscription: &Subscription, entitlements: StreamEntitlements, endpoint: Url, config: StreamConfig, ) -> Result<Self, WebSocketError>
Connects to a trusted explicit current endpoint; ws is loopback-only.
Use this for FMP-assigned endpoints or real local integration servers. URL credentials, query parameters, and fragments are rejected.
Sourcepub const fn subscription(&self) -> Subscription
pub const fn subscription(&self) -> Subscription
Returns the configured subscription without claiming server verification.
Sourcepub async fn subscribe(
&mut self,
stream: &MarketStream,
) -> Result<(), WebSocketError>
pub async fn subscribe( &mut self, stream: &MarketStream, ) -> Result<(), WebSocketError>
Subscribes to an explicitly granted exchange, synthetic, or delayed stream.
Sourcepub async fn unsubscribe(
&mut self,
stream: &MarketStream,
) -> Result<(), WebSocketError>
pub async fn unsubscribe( &mut self, stream: &MarketStream, ) -> Result<(), WebSocketError>
Stops an explicitly granted stream using the documented unsubscribe event.
Sourcepub async fn next_event(&mut self) -> Result<WebSocketEvent, WebSocketError>
pub async fn next_event(&mut self) -> Result<WebSocketEvent, WebSocketError>
Receives a strictly validated snapshot, heartbeat, control, pong, or close.
Sourcepub async fn close(self) -> Result<(), WebSocketError>
pub async fn close(self) -> Result<(), WebSocketError>
Completes a close handshake within the configured handshake timeout.