Module websocket

Module websocket 

Source
Expand description

High-performance WebSocket client implementation with automatic reconnection with exponential backoff and state management. Key features:

  • Connection state tracking (ACTIVE/RECONNECTING/DISCONNECTING/CLOSED).
  • Synchronized reconnection with backoff.
  • Split read/write architecture.
  • Python callback integration.

Design:

  • Single reader, multiple writer model.
  • Read half runs in dedicated task.
  • Write half runs in dedicated task connected with channel.
  • Controller task manages lifecycle.

Structs§

WebSocketClient
WebSocket client with automatic reconnection.
WebSocketConfig
Configuration for WebSocket client connections.

Constants§

TEXT_PING
TEXT_PONG

Functions§

channel_message_handler
Creates a channel-based message handler.

Type Aliases§

MessageHandler
Function type for handling WebSocket messages.
MessageReader
PingHandler
Function type for handling WebSocket ping messages.