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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 1 3 7

Web Socket API - Process implementation Confirmation

Dear @umer.nalla , @wasin.waeosri,

We have implemented Websocket API to consume data from Refinitiv Real-Time by creating a Websocket connection to the Advanced Distribution Server (ADS) component of Refinitiv Real-Time Distribution System.

We are following the following process to fetch rates every 10 secs. Please let us know in case of any comments or issues process wise for the same.

1. Call Authentication and fetch access Token

2. Establishing a Websocket connection to the server and Login with the access token generated

{
  "ID": 1,
  "Domain": "Login",
  "Key": {
    "NameType": "AuthnToken",
    "Elements": {
      "AuthenticationToken": "eyJ0eXA...gZ9d8kCpeng",
      "Position": "10.100.30.35",
      "ApplicationId": "256"
    }
  }
}

3. If Login is successful then Sending a ‘Batch’ request for multiple data items

    {"ID":2,"Key":{"Name":["GBP=","INR=","CAD=","JPY=","DKK=","EUR="]},"Service":"ELEKTRON_DD"}

4. Once socket responds to a Batch request

a. Closing items (Closing multiple streams ) as per Ids received

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

6. Logoff from server and close all open streams

         {"ID":1,"Type":"Close","Domain":"Login"}
elektronwebsocketsrrtorefinitiv-realtime-optimised
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.5k 16 7 10

Hello @kishore.karanam

Could you please let me know if you want to connect to a local Advanced Distribution Server (ADS) in your environment or to RTO (Real-time Optimized) on the cloud? Based on your previous post, you said you will connect to the RTO, not the local deployed ADS.

RTO Case

The steps above are correct for the RTO scenario. Please note that you can keep the WebSocket connection alive via the following steps:

  1. re-authenticate with RDP API using a refresh token before token expiration to get a new token
  2. Re-issue login request to the WebSocket server with a new access token before token expiration to keep session open.

The other important thing is you need to send a Pong message back to the server if the server sends a Ping message to the application. These ping-pong messages act as a heartbeat mechanism between the client and server.

Local RTDS Case

However, if you want to connect to your local deploy ADS server, steps 3 - 6 are the same.

If your local ADS already connects to the DACS server (Data Acess Control System Server), you do not need to get the access token from the RDP API Auth service. You can log in to the ADS server with the following JSON login request message:

{
  "Domain": "Login",
  "ID": 1,
  "Key": {
    "Elements": {
      "ApplicationId": "256",
      "Position": "<You IP Address>"
    },
    "Name": "DACS Username"
  }
}

Please find more detail from the Connect to Refinitiv Real-Time Distribution System tutorial.

Additionally, is there a particular reason you are using Websocket API rather than EMA Java as recommended in an earlier post?

EMA Java is generally much simpler to use than Websocket API and also delivers a higher performance level than Websocket API.



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
20.3k 73 10 20

Hi @kishore.karanam

The other thing to clarify is that we would not recommend you keep logging off and Login again every 10 secs - unnecessary processing and bandwidth usage.

As my colleague mentioned, you can keep the connection + session alive by refreshing the token (for RTO only) and sending Pong messages (RTO and RTDS).

And then you can just send your Batch request every 10 secs. Furthermore, if you send the request as a Non-Streaming snapshot request, you don't need to close the stream - the server will close the stream once it responds with the data (or status message for invalid request).

Snapshot Tutorial

You can combine Batch with Snapshot by just adding the Streaming : False to your Batch Request e.g.

{
  "ID":2,
  "Key":{
    "Name":[
      "VOD.L",
      "BT.L",
      "BP.L"
    ],
    "Service":"ELEKTRON_DD"
  },
  "Streaming":false
}


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
3 1 3 7

Dear wasin.waeosri , umer.nalla

We are using RTO (Real-time Optimized) on the cloud.

Kindly let us know more details/links/Sample Client etc regarding fetching rates through EMA Java.

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.

Upvote
11.5k 16 7 10

Hello @kishore.karanam

You can download the RTSDK Java package which included the EMA Java API library files, example code, documents, etc from the Real-Time SDK Java download page. I highly recommend you check the RTSDK Build System page regarding how to build and run the API.

I suggest you check the example ex113_MP_SessionMgmt which connects and consumes data from the RTO endpoint. If you are interesting the Service Discovery feature, you can check the ex450_MP_QueryServiceDiscovery example.

You can find more detail about the EMA Java API with the RTO connection from the following resources:

There are two videos tutorials that might help you too.

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