A single WebSocket connection streams live market data (LTP, OHLC, depth, indices, market open/close). This guide is language-agnostic: any language with a WebSocket library and the ability to read little-endian binary data can implement a client.
It covers the native_batch protocol only. If you use the official Python SDK
(kotakneoapi), all of the decoding below is done for you — read this when you’re
building your own client in another language, or when you want to understand what the
SDK does under the hood.
One socket carries two planes:
| Plane | Frames | Direction | Used for |
|---|---|---|---|
| Control | JSON text | both ways | auth, subscribe, unsubscribe, snapshot, acknowledgements |
| Data | binary (little-endian, often batched) | server → you | the actual ticks |
Three rules hold everywhere on the data plane:
#pragma pack(1)).1234.56 arrives as 123456 with divider 100.Set your socket’s binary type to raw bytes (arraybuffer or your language’s
equivalent) before reading data frames.
message_code / level (§6.2).