Module websocket

Module websocket 

Source
Expand description

WebSocket-based asset information providers and streaming mechanisms.

This module provides functionality for streaming asset information in real-time from WebSocket APIs. It defines traits for WebSocket connectors and providers, as well as a function for starting a listening loop.

The module provides:

§WebSocket Strategy

The WebSocket strategy follows these principles:

  1. Persistent Connections: Maintains persistent WebSocket connections for real-time data
  2. Automatic Reconnection: Automatically reconnects with exponential backoff if the connection is lost
  3. Subscription Management: Provides a standard way to subscribe to asset updates
  4. Error Resilience: Handles connection failures and data errors gracefully

When implementing new WebSocket-based asset providers, implement both the AssetInfoProviderConnector and AssetInfoProvider traits, and use the start_listening function to handle the connection lifecycle.

Enums§

Data
Represents different types of data that can be received from a WebSocket connection.

Traits§

AssetInfoProvider
Trait for providers that can stream asset information from WebSocket APIs.
AssetInfoProviderConnector
Trait for factory objects that can establish connections to WebSocket providers.

Functions§

start_listening
Starts listening for asset information from a WebSocket provider.