Unsubscribe
Send UNSUBSCRIBE with the names of the channels to leave. Unlike SUBSCRIBE, one message can name several channels. Unsubscribing from a market data channel drops all of its instruments. The server answers with one UNSUBSCRIBED per channel, or an UNSUBSCRIBE_ERROR for a channel it cannot unsubscribe, such as an unknown name.
Connection-level messages on the shared socket: authentication, generic subscribe and unsubscribe, heartbeats and errors.
const payload = { "type": "UNSUBSCRIBE", "channels": [ "ORDER_BOOK", "PRICE_TICKS" ]};const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("open", () => { socket.send(JSON.stringify(payload));});channels lists plain channel names, not the objects SUBSCRIBE takes. Unsubscribing from a market data channel drops all of its instruments; to keep some, subscribe to them again afterwards.
- payload
type*stringchannels*array<>The channels to leave, as plain channel names. Unlike SUBSCRIBE, several can be named in one message.
1 <= itemsUnsubscribe from ORDER_BOOK and PRICE_TICKS
{ "type": "UNSUBSCRIBE", "channels": [ "ORDER_BOOK", "PRICE_TICKS" ]}Reply
Sent back on the same channel.