Real-Time Streaming
PushClient is a process-wide singleton. A Tiger ID can have only one active connection; a newer connection reports ConnectionKickout to the old one. Configure TigerConfig and a complete IApiComposeCallback before connecting.
// callback is an instance of the complete IApiComposeCallback implementation from the callbacks page
PushClient client = PushClient.GetInstance()
.Config(config)
.ApiComposeCallback(callback);
if (!await client.ConnectAsync())
throw new InvalidOperationException("push connection failed");
uint requestId = client.SubscribeQuote(new HashSet<string> { "AAPL" });The connection timeout constant is 5000 ms and retry interval is 2000 ms. Call Disconnect() on shutdown. Market-data streams require market data access; account streams require account access permission. Confirmation arrives asynchronously in SubscribeEnd; request ID 0 means the client was disconnected when called.
After an unexpected disconnect, the client reconnects automatically but does not retain or restore subscriptions, and missed messages are not replayed. Resubscribe after receiving ConnectionAck again, and parse the JSON in SubscribeEnd.result; only an inner code == 0 indicates success.
Updated about 1 month ago
