Skip to Content

General WebSocket - Unsubscribe

This guide explains how to stop receiving selected updates on the General WebSocket without closing the connection.

USE CASE

Stop receiving updates you no longer need, such as price alerts, while keeping the connection open.

Details

To Unsubscribe for different actions, create a message data, which would be the string format for json node.
Json node params

Convert the json to string and send this message to the socket to unsubscribe for the action_data mentioned.

message

message = json.dumps({ "T": "SUB_ORD", "SLIST": action_data, "SUB_T": -1 })

T Type: String
value: SUB_ORD (Fixed)

action_data Type: List/Array
Value: orders trades positions edis pricealerts login

Based on the list passed in action_data, web_socket data will be received.

SUB_T Type: Integer
Value: -1 (value -1 is for unsubscribing and 1 for subscribe)

Good to know
  • The message is the same as the subscribe message. Only SUB_T changes: -1 unsubscribes and 1 subscribes.
  • Put the actions you want to stop in SLIST, using the same names as when subscribing: orders, trades, positions, edis, pricealerts, login.
  • In the Python SDK, unsubscribe(data_type) takes the same comma-separated names as subscribe and sends this message for you.
Last updated on