Hi @Hardik @Bhavya_Jain @Divyesh @Jubin_Varghese @PravinJ @Vaibhav_Lad @Mohseen_Usmani @MahimaShah @Madiya_Khatri @Mrunmayi_Vaity
Subscribe (RequestCode 23) works fine. The annexure says 25 = Unsubscribe Full Market Depth, but the depth guide shows no unsubscribe at all, only 23 and 12 (disconnect).
When we send 25, nothing comes back: no acknowledgement and no error. The socket keeps streaming the instrument. Example: we unsubscribed SecurityId 78305 at 9:16 AM and its depth was still arriving 2.5 minutes later. We also tried 24 and got the same result. Over thousands of unsubscribes each day, none took effect.
The only workaround is to disconnect and resubscribe. Because the depth feed sends no snapshot on subscribe, every resubscribe leaves the book blank until it next changes.
Has anyone got depth unsubscribe working? Dhan team, which code and message format is correct, and is there any response to expect?
Hi @Parthiban_Sub ,
We are currently reviewing the query raised by you regarding the unsubscribe functionality for the Full Market Depth feed. Our team is checking the request codes, message format, and the expected behaviour of the unsubscribe request sent by you over the email.
1 Like
Hi @Parthiban_Sub ,
To unsubscribe from the Full Depth WebSocket feed using Request Code 25, you need to pass the same instrument details that were used while subscribing.
{
"RequestCode": 25,
"InstrumentCount": 1,
"InstrumentList": [
{
"ExchangeSegment": "NSE_EQ",
"SecurityId": "11536"
}
]
}
Sending only Request Code 25 will not unsubscribe the feed :
{
"RequestCode": 25
}
If you want to terminate the entire Full Depth WebSocket connection, you can use Request Code 12 :
{
"RequestCode": 12
}
Request Code 12 is used to terminate the complete WebSocket connection. We will also be updating the documentation to reflect this information for better clarity.
Feel free to connect with us for more queries on apihelp@dhan.co.