Unsubscribe a ric using websocket

Hello,

We are using websocket to get Market Price updates for rics such as GBP=, EUR= etc.

We send the below batch json request for an example to register multiple RIC at once in comma separated format in json field as an array:

"{\"ID\":2,\"Domain\":\"MarketPrice\",\"Key\":{\"Name\":[\"EUR=\", \"GBP=\"]}}";

We have a requirement where we need to dynamically unregister/unsubscribe to receive an update for a particular RIC, let say for "GBP=". Please can someone provide us an idea on how this can be achieved. How the JSON request will look like for unsubscribing RIC.

Best Answer

  • Hi @amar04.panigrahy

    You can unsubscribe a RIC using Close message. The Close message needs to contain stream ID to be closed. For more information and example, please see Batch section.

    {
    "ID": 3,
    "Type": "Close"
    }

    For Batch request message, you can get stream ID for each item from Refresh message's Key.

    RECEIVED:
    [
    {
    "ID": 3,
    "Type": "Refresh",
    "Key": {
    "Service": "API_ELEKTRON_EDGE_TOKYO",
    "Name": "EUR="
    },

    You can also unsubscribe multiple RICs using Batch Close.

    {
    "ID": [
    3,
    4,
    5
    ],
    "Type": "Close"
    }

Answers