pub struct WebSocketClient { /* private fields */ }Expand description
An authenticated connector to FMP’s legacy stock, crypto, or forex cluster.
For current market streams, use StandardWebSocketClient.
Implementations§
Source§impl WebSocketClient
impl WebSocketClient
Sourcepub async fn connect(
api_key: &str,
subscription: &Subscription,
cluster: WebSocketCluster,
config: WebSocketConfig,
) -> Result<Self, WebSocketError>
pub async fn connect( api_key: &str, subscription: &Subscription, cluster: WebSocketCluster, config: WebSocketConfig, ) -> Result<Self, WebSocketError>
Connects to the documented legacy cluster endpoint and confirms login.
Sourcepub async fn connect_to(
api_key: &str,
subscription: &Subscription,
cluster: WebSocketCluster,
endpoint: Url,
config: WebSocketConfig,
) -> Result<Self, WebSocketError>
pub async fn connect_to( api_key: &str, subscription: &Subscription, cluster: WebSocketCluster, endpoint: Url, config: WebSocketConfig, ) -> Result<Self, WebSocketError>
Connects to a trusted explicit legacy endpoint; ws is loopback-only.
Sourcepub const fn cluster(&self) -> WebSocketCluster
pub const fn cluster(&self) -> WebSocketCluster
Returns the legacy cluster used by this connector.
Sourcepub async fn subscribe(
&mut self,
symbols: &[&str],
) -> Result<(), WebSocketError>
pub async fn subscribe( &mut self, symbols: &[&str], ) -> Result<(), WebSocketError>
Subscribes to validated lowercase legacy ticker symbols.
Sourcepub async fn unsubscribe(
&mut self,
symbols: &[&str],
) -> Result<(), WebSocketError>
pub async fn unsubscribe( &mut self, symbols: &[&str], ) -> Result<(), WebSocketError>
Unsubscribes from validated lowercase legacy ticker symbols.
Sourcepub async fn next_event(&mut self) -> Result<WebSocketEvent, WebSocketError>
pub async fn next_event(&mut self) -> Result<WebSocketEvent, WebSocketError>
Receives a typed update, control, pong, or remote close event.
Sourcepub async fn close(self) -> Result<(), WebSocketError>
pub async fn close(self) -> Result<(), WebSocketError>
Completes a close handshake within the configured timeout.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WebSocketClient
impl !RefUnwindSafe for WebSocketClient
impl !UnwindSafe for WebSocketClient
impl Send for WebSocketClient
impl Sync for WebSocketClient
impl Unpin for WebSocketClient
impl UnsafeUnpin for WebSocketClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more