Skip to main content

Module websocket

Module websocket 

Source
Expand description

Bybit WebSocket API client implementation.

This module provides the WebSocketConnector and WebSocketConnection for interacting with the Bybit WebSocket API. It enables real-time streaming of market data, such as ticker updates, and is used internally to implement the AssetInfoProvider trait for asset workers.

This module provides:

  • Establishes WebSocket connections to Bybit servers
  • Subscribes and unsubscribes to ticker streams for specified symbols
  • Processes incoming WebSocket messages, including ticker updates and ping events
  • Transforms WebSocket messages into AssetInfo for use in workers
  • Handles connection management, including closing connections gracefully

Structsยง

WebSocketConnection
Represents an active WebSocket connection to Bybit.
WebSocketConnector
A connector for establishing WebSocket connections to the Bybit WebSocket API.