developers:websocket

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
developers:websocket [2025/03/14 17:50] chaddevelopers:websocket [2025/03/14 19:15] (current) – [Message Structure Overview] chad
Line 4: Line 4:
  
 ==== WebSockets ==== ==== WebSockets ====
-WebSockets establish a persistent, full-duplex connection between the client and server, allowing for continuous message exchange without the overhead of HTTP polling. This ensures minimal latency, making it ideal for market data feeds and order updates.+WebSockets establish a persistent, full-duplex connection between the client and server, allowing for continuous bi-directional message exchange. This ensures minimal latency, making it ideal for market data feeds and order updates.
  
 **Key Advantages:** **Key Advantages:**
Line 25: Line 25:
  
 ==== Message Structure Overview ==== ==== Message Structure Overview ====
-All messages are wrapped within a top-level client or server message envelope. This structure ensures extensibility and consistency across different message types. 
  
-**Example Envelope:** +All messages sent to the server must be wrapped in a **ClientMessage** envelope, and all messages received from the server will be contained within a **ServerMessage** envelope. This ensures a consistent structure and simplifies message parsing. 
-```+ 
 +=== Client Message Structure === 
 + 
 +A **ClientMessage** is the top-level wrapper for all messages sent to the server. It contains fields for various message types, such as authentication requests, order submissions, and subscription requests. 
 + 
 +Example **ClientMessage**: 
 + 
 +<code>
 message ClientMessage { message ClientMessage {
   oneof payload {   oneof payload {
-    SubscribeRequest subscribe = 1; +    AuthenticationRequest authentication_request = 1; 
-    OrderRequest order = 2;+    MarketSubscription market_subscription = 2; 
 +    OrderRequest order_request = 3; 
 +    // ... other client messages
   }   }
 } }
 +</code>
  
 +=== Server Message Structure ===
 +
 +A **ServerMessage** is the top-level wrapper for all responses and updates from the server. It encapsulates messages related to market data, account updates, and execution reports.
 +
 +Example **ServerMessage**:
 +
 +<code>
 message ServerMessage { message ServerMessage {
   oneof payload {   oneof payload {
-    MarketUpdate market_data = 1; +    AuthenticationResponse authentication_response = 1; 
-    OrderResponse order_response = 2;+    MarketSnapshot market_snapshot = 2; 
 +    OrderUpdate order_update = 3; 
 +    // ... other server messages
   }   }
 } }
-```+</code> 
 + 
 + 
 +=== Message Tools === 
 + 
 +The [[https://github.com/CTS-Futures/t4-api-tools|T4 API Tools repository]] has code that makes wrapping messages from your client very easy. 
 + 
 +<bootnote> 
 +Reach out to support if you would like a API tool's for a language we have not covered yet. 
 +</bootnote> 
 + 
 +^ **Platform** ^ **Client Message Helper** ^ 
 +| **.Net** | [[https://github.com/CTS-Futures/t4-api-tools|ClientMessageHelper.cs]]| 
 + 
  
-This design enables efficient message parsing while maintaining flexibility. 
  
-==== Next Steps ==== 
-Continue to the **[Connecting and Authenticating](developers:websocket:connecting)** section to learn how to establish a WebSocket connection and authenticate your session. 
  
  
  • developers/websocket.1741974649.txt.gz
  • Last modified: 2025/03/14 17:50
  • by chad