Real-time Updates
The Real-time Updates system in OADA-UI provides live data synchronization through WebSocket connections, enabling instant updates for prices, portfolio values, and transaction status. This section details the core components and their implementations.
WebSocket Integration
The WebSocket integration system provides real-time communication with the backend server. Let's break down the key components:
The WebsocketContextType
defines the type for the WebSocket context:
The WebsocketContext
creates a React context for sharing the WebSocket instance:
The WebsocketProvider
component manages the WebSocket connection lifecycle:
Key features of the Real-time Updates system include:
WebSocket Integration
Automatic connection management
Heartbeat mechanism for connection health
Automatic reconnection on failure
Message processing and dispatch
Portfolio Value Tracking
Real-time balance updates for all tokens
Support for multiple asset types (ADA, OADA, sOADA, etc.)
Automatic conversion between units (lovelace to ADA)
Virtual UTxO management for pending transactions
Transaction Status Monitoring
Real-time UTxO updates
Transaction confirmation tracking
Virtual UTxO support for pending transactions
Automatic pruning of confirmed transactions
Error Handling
Connection error recovery
Automatic reconnection attempts
Message validation and error reporting
Graceful degradation on failures
The system provides a comprehensive interface for real-time data synchronization, ensuring that users always have access to the latest information about their portfolio and transactions.
Last updated