ARTICLE

How to test  the WebSocket connection with the Infrastructure testclient tool

Wasin Waeosri
Developer Advocate Developer Advocate

Overview

Update: December 2021.

Websocket API for Pricing Streaming and Real-Time Service aka Websocket API enables easy integration into a multitude of client technology environments such as scripting and web. This API runs directly on your Refinitiv Real-Time Distribution System and presents data in an open (JSON) readable format. The API supports all Refinitiv data models and can be integrated into multiple client technology standards e.g. JavaScript, Python, R, .Net, etc.

The testclient tool (formerly known as rmdstestclient) is a general-purpose Refinitiv Real-Time consumer application. Its basic functionality is to load a list of RICs from file and request data of them from Refinitiv Real-Time sources like the Refinitiv Real-Time Advanced Distribution Server, EMA server, and Real-Time SDK OMM Provider.

This article shows how to use the testclient tool to verify and test the Refinitiv Real-Time Advanced Distribution Server WebSocket connection and subscription.

*Note: This article is for deployed Refinitiv Real-Time Advanced Distribution Server (version 3.2.1 and above) customers only. If you are Refinitiv Real-Time -- Optimized (RTO) user, please check the WebSocket API Quick Start - Connecting to RTO page.

WebSocket Overview

WebSocket specification defines an API that enables web pages to use the WebSockets protocol for two-way communication with a remote host. It introduces the WebSocket interface and defines a full-duplex communication channel that operates through a single socket over the Web. This specification was also later applied to other client technology sides like Python, Ruby, Go, Java, etc.

Figure-1: WebSocket connection diagram

testclient tool Overview

The testclient is part of the Infrastructure Tools (aka Refinitiv Real-Time Distribution System Demo tools). You can download the tools package from the Developer Portal and my.refinitiv.com websites. The tool is also bundled with Real-Time Advanced Distribution Server package (available at <Real-Time Advanced Distribution Server package>/<platform>/demo folder) too. It supports various Real-Time Advanced Distribution Server connection types (RSSL, WebSocket, etc), various Refinitiv Data Domain data (Market Price, Market By Price, Market By Order, etc). This tool is perfect for verifying the Real-Time Advanced Distribution Server connection and subscription

Figure-2: Infra Tools demo folder structure

Figure-3: Real-Time Advanced Distribution Server 3.2 demo folder structure

Basic testclient arguments and how to run the tool

You can run the testclient tool via the following steps

  1. Goto <Real-Time Advanced Distribution Server 3.2 package>/<platform>/demo or <Infrastructure Tools>/<platform>/demo folder via the command line (from Linux terminal or any SSH applications)
  2. Export LD_LIBRARY_PATH to <Real-Time Advanced Distribution Server 3.2 package>/<platform>/demo location via the following command
    	
            
$>export LD_LIBRARY_PATH=<Real-Time Advanced Distribution Server package>/<platform>/demo

Or

    	
            $>export LD_LIBRARY_PATH=<Infrastructure Tools>/<platform>/demo
        
        
    

3.   Create the item.txt file, then input the RIC name in each line

    	
            

FB.O

VOD.L

PTT.BK

4.   Run the testclient tool via the following command

    	
            
$> ./testclient -S <Service name> -h <Real-Time Advanced Distribution Server IP Address or Hostname> -ct <Connection type> -p <WebSocket port> -l stdout -X -f item.txt -v -d 3 –Z –md <domain> –u <username>

You can run it with just ./testlcient command to get information of all command-line arguments that you can set with the tool

Figure-4: testclient manual

How to connect testclient with WebSocket connection

Users can use -ct ws_json2 -dfile <RDMFieldDictionary file> -p <WebSocket port> parameters to connect testclient with Real-Time Advanced Distribution Server WebSocket connection.

  • -ct ws_json2 parameter means to specify the tool to connect to Real-Time Advanced Distribution Server via the WebSocket connection
  • -dfile <RDMFieldDictionary file> is a required parameter when connecting via WebSocket connection . This parameter specifies the Refinitiv Real-Time's Dictionary RDMFieldDictionary file for testclient tool.
  • -p <WebSocket port> specifies the Real-Time Advanced Distribution Server WebSocket port (this port can be configured in Refinitiv Real-Time Advanced Distribution Server configurations *ads*wsPort parameter)

Example command

    	
            
$> ./testclient -h 172.20.33.11 -p 15000 -S ELEKTRON_DD -ct ws_json2  -dfile ./RDMFieldDictionary -l stdout -X -f item.txt -v -d 3 –Z –md 6 –u api

Result