WebSocketProxy provides a C++ WebSocket proxy framework that empowers you to share a single WebSocket connection among multiple clients, maximizing resource utilization and streamlining real-time data access.
Designed initially for the Alpaca.Market, which offers data via both REST and WebSockets. However, Alpaca limits the number of concurrent WebSocket connections per account. WebSocketProxy solves this by enabling multiple strategies under the same account to receive real-tine market data updates through a single, shared WebSocket connection.
WebSocketProxy consists of two components:
- Standalone proxy server executable: This executable acts as the central communication hub. It manages the connection to the WebSocket server and handles data forwarding between clients. It's launched upon the first client attempting a WebSocket connection, ensuring only one server instance runs simultaneously. Any subsequent server launch attempts automatically terminate, preventing resource conflicts. The server continues execution until all connected clients are closed.
- Header-only Proxy Client: This lightweight client library integrates into your individual applications. It manages communication with the proxy server and provides a familiar interface for sending and receiving data.
- Efficient Resource Utilization: Share a single WebSocket connection, reducing overhead and improving resource management.
- Real-Time Data Streamlining: Multiple trading strategies within an account gain access to crucial market updates concurrently.
- Simplified Integration: The header-only client library enables effortless integration with your existing client applications.
- Shared Memory Optimization: Communication between server and clients leverages shared memory ring buffers, ensuring high-performance data exchange.