The ERT (Elektron RealTime) controller, formally TRWebSocketController, is a series of JavaScript interfaces used to manage communication to the ERT streaming services available within either the Elektron Data Platform (EDP), a locally deployed TREP environment or through your Eikon Desktop installation. Delivering real-time market data to the browser, the JavaScript interface is designed as a reusable component that can be used in a variety of simple web-based applications and prototypes.
For any question related to this component, please use the Developer Community Q&A Forum.
Note: To be able to ask questions and to benefit from the full content available on the Developer Community portal we recommend you to register here or login here.
The source code presented in this project has been written by Refinitiv only for the purpose of illustrating the concepts of interfacing with ERT streaming services. It has not been tested for a usage in production environments.
The ERTController components provide the ability to connect to the streaming services via a TREP (ADS) local deployment, within your Eikon desktop installation (future) or directly to EDP/ERT in the cloud.
The components outlined below provide JavaScript applications to easily interface with the ERT streaming services in multiple ways.
-
server.js
When requesting for streaming services from EDP/ERT, applications must be authenticated using the HTTP EDP authentication services prior to connecting into the ERT in the cloud over WebSockets. To adhere to the "Same Origin" security policies, a simple server-side application (server.js) is provided which will act as an application proxy managing EDP authentication.
The server side application is based on Node.js's Express.js framework. This server application acts a web server and application/proxy server for managing all HTTP REST communication from a web browser to EDP HTTP REST services.
-
ERTRESTController.js
The ERTRESTController is a generic interface used to manage all HTTP communications in a web browser to EDP HTTP REST server via server.js.
-
ERTWebSocketController.js
The ERTWebSocketController is a generic interface used to manage all WebSocket communications to the ERT real-time services.
Software components used:
-
Elektron WebSocket API - Interface to access Elektron real-time market data.
-
Pako (v1.0.6) - Nodejs-based ibrary used to decompress Elektron Machine Readable News (MRN) headlines and stories. Applications utilizing the news capabilities offered within this interface must include the 'zlib.js' script within their HTML.
Note: The 'zlib.js' file was prepared by browserfying the pako library. This is a process to bring the capabilities of the node.js library to the browser. For convenience and interest, I've included the node.js-based file called 'pako.js' which I used to create the 'zlib.js' package. Refer to 'pako.js' file for general instructions as to how I did this.
The package contains a number examples demonstrating different features available within the components. Based how you plan to access the ERT streaming services, will require a unique setup and configuration.
To execute all TREP-based examples requires the specific JavaScript source to be loaded within your browser. Once loaded, the example will form a direct connection into your deployed TREP/ADS server. Refer to the section of code within the example JavaScript source that requires the connection and authentication details:
// Connect into the ERT streaming services via TREP...
ertController.connectADS("ewa", "15000", "user");
Connecting into the cloud from your browser will require the JavaScript to run within a local proxy. The browser enforces the Same-origin policy which is a critical security mechanism to reduce malicious attacks.
To setup your environment to run the EDT/ERT examples, perform the following steps:
-
Within the installation directory, install Node.js modules by executing the following.
Note: Node.js must be installed on your machine.
$> npm install
This will create a local directory called node_modules/ containing the modules to run a local HTTP server.
-
Start your server
$> node server.js
This will start a local HTTP server running on port 8080.
Note: If the machine is behind a proxy server, you need to configure Node.js to use a proxy instead of a direct HTTP connection via the following command in a command prompt:
set https_proxy=http://<proxy.server>:<port>
-
Configure your access within your specific example. Refer to the section of code that requires the authentication details:
// Authenticate with EDP... edpController.get_access_token({ 'username': '<username>', 'password': '<password>', 'clientId': '<AppKey>' });
-
Load your example within the browser using the following URL format:
http://localhost:8080/<example>.html
Example:
http://localhost:8080/EDP_quoteExample.html
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Nick Zincone - Release 1.0. Initial version
This project and the Pako library are licensed under the MIT License - see the LICENSE.md file for details.