WSt: 't' (subscribe) / 'u' (unsubscribe)
Subscribe to Market Feed
Subscribe to live touchline ticks for one or more instruments over the WebSocket connection established in WebSocket Overview.
Subscribe to live touchline ticks for one or more instruments over the WebSocket connection established in WebSocket Overview.
Overview
After connecting and receiving
s: "Ok"per WebSocket Overview, send a subscribe frame listing the instruments (asEXCHANGE|TOKENpairs) you want ticks for. The gateway sends one full-snapshot acknowledgment per subscribed instrument — the number oftkacks you receive equals the number of scrips in yourkfield — then streams incremental updates as fields change.Subscribe frame (t: 't')
t#-delimitedEXCHANGE|TOKENpairs, e.g.NSE|22#BSE|508123#NSE|NIFTY.Acknowledgment (t: 'tk')
Sent once per subscribed instrument, carrying every field currently known. Aside from
t,e, andtk, any other field may or may not be present depending on instrument type:tk— represents the touchline acknowledgment.Incremental updates (t: 'tf')
Except for
t,e, andtk, other fields are only sent when they change since the last message — everything else is implicitly unchanged from the state you've already built up client-side:tk. Maintain a local dictionary keyed by token and merge eachtfmessage into it — don't treat any single message after subscription as a complete quote.Unsubscribe (t: 'u')
Request:
Acknowledgment:
u(request) /uk(ack)#-delimited scrip list that was unsubscribed.Best practices
bp1/sp1pair is touchline (level-1) only.Notes
Field presence varies by instrument type — index tokens won't carry
bp1/sp1, and equity tokens won't carryoi/poi/toi. Check for field presence rather than assuming a fixed shape.