For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 2

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.

treprdp-apiwebsocketsrrtopricing
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
11.3k 25 8 13

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"
}
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13k 32 12 18

@amar04.panigrahy, You may find this article about Websockets Batch and View feature helpful. Close request is described in the end, along with a working sample.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea