Why subscriptions message is NOT always received first in client side?

Hello,

Based on my observation, the subscriptions message may sometimes come after last_match/snapshot/ticker etc.

Question> Is this normal?
My expectation is that I should always receive the subscriptions first before I could process all other messages. If the sequence order of subscriptions is undefined & unpredictable, what is the usage of the subscriptions message? Since I never unsubscribe from a channel, is it safe that I can simply ignore the subscriptions altogether?

Thank you

For example,

{"type": "subscribe", "product_ids":["DOGE-BTC"], "channels":["matches", "heartbeat", "level2", "ticker"]}

{"type":"last_match","trade_id":1446442,"maker_order_id":"80d9cc49-eab9-4fc2-aff8-05df6702dda7","taker_order_id":"051f0ede-182f-46cb-9e5a-ce94c988e7f6","side":"buy","size":"10.9","price":"0.00000338","product_id":"DOGE-BTC","sequence":280384809,"time":"2022-04-22T14:15:26.752058Z"}
{"type":"snapshot","product_id":"DOGE-BTC","asks":[...}
{"type":"ticker","sequence":280384809,"product_id":"DOGE-BTC","price":"0.00000338","open_24h":"0.00000331","volume_24h":"6404146.10000000","low_24h":"0.0000033","high_24h":"0.0000034","volume_30d":"384040264.40000000","best_bid":"0.00000338","best_ask":"0.00000339","side":"sell","time":"2022-04-22T14:15:26.752058Z","trade_id":1446442,"last_size":"10.9"}
{"type":"subscriptions","channels":[{"name":"matches","product_ids":["DOGE-BTC"]},{"name":"heartbeat","product_ids":["DOGE-BTC"]},{"name":"level2","product_ids":["DOGE-BTC"]},{"name":"ticker","product_ids":["DOGE-BTC"]}]}

Hello @q0987! The usage of the subscription messages is dependent on the subscription and amount of data the customer is receiving. The Acknowledgement Code (ACK) of the subscription may come after some initial data due to race conditions (i.e. a level 2 update beats the ACK back from the server).

You should also listen for the subscription ACK to confirm that it matches what you asked for, then you can use that response to unsubscribe to relevant channels.

Thanks!

Hello,

Is it true that the server will NEVER send unsubscribe level2 and matches to clients?

For example,

If I ONLY subscribed DOGE-BTC for level2 and matches, can server send me ETH-BTC for any reasons?

Thank you

Hi @q0987 there may be a lag after you unsubscribe and when updates stop flowing in. But each update has the crypto pair in the response, so you can ignore it.

1 Like

Thank you very much!