|
3 | 3 |
|
4 | 4 | [Elektron WebSocket API](https://developers.thomsonreuters.com/elektron/websocket-api-early-access) enables easy integration into a multitude of client technology environments such as scripting and web. This API runs directly on your TREP infrastructure or the Thomson Reuters platform and presents data in an open (JSON) readable format. The API supports all Thomson Reuters Elektron data models and can be integrated into multiple client technology standards e.g. Python, R, .Net etc. |
5 | 5 |
|
6 | | -The web browsers JavaScript runtime is a single-threaded environment. This limitation makes JavaScript cannot concurrent handles UI events, query, data processing and network connection logic which causes the UI blocking scenario in the web browsers. The HTML standard's introduces the [Web Workers](https://html.spec.whatwg.org/multipage/workers.html) to solve this issue. It lets web browsers run JavaScripts in background threads without blocking the UI. It can perform I/O, XMLHttpRequest and the WebSocket connection in a background thread while the main JavaScript thread handles UI interaction. |
| 6 | +The web browsers JavaScript runtime is a single-threaded environment by default. However, the HTML standard lets developers implement multi threads JavaScript application in web browser by introducing the [Web Workers](https://html.spec.whatwg.org/multipage/workers.html) feature that lets web browsers run JavaScripts in a main thread and a background thread (workers thread). |
7 | 7 |
|
8 | | -There are two types of the Web Workers, [Dedicated Workers](https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-worker-interface) and [Shared Workers](https://html.spec.whatwg.org/multipage/workers.html#sharedworker). This example covers only how to implement the Elektron WebSocket API with JavaScript web browser application with Dedicated Workers. The example lets the Web Workers handle a connection logic with Elektron WebSocket API in a separate thread while the main thread handles the UI events and displaying data. |
| 8 | +This example shows how to implement the Elektron WebSocket API with JavaScript web application with Web Workers. It lets the Web Workers thread handles a connection logic with ADS WebSocket while the main thread handles the UI interaction events and displaying data. |
| 9 | + |
| 10 | +There are two types of the Web Workers, [Dedicated Workers](https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-worker-interface) and [Shared Workers](https://html.spec.whatwg.org/multipage/workers.html#sharedworker). This example covers only how to implement the Elektron WebSocket API with JavaScript web browser application with Dedicated Workers. |
9 | 11 |
|
10 | 12 | ## Supported Web Browsers |
11 | | -The example supports Chrome, Firefox and IE11 (based on the WebSocket and Web Workers browser supported). |
| 13 | +The example supports Chrome, Firefox and IE11 (based on the WebSocket and Web Workers browser supported platform). |
12 | 14 |
|
13 | 15 | ## Prerequisite |
14 | | -The following libraries are required for this example. They are need to be downloaded separately: |
15 | | -1. [jQuery 3.2.1](https://jquery.com/) |
| 16 | +This example uses the following 3rd party libraries. |
| 17 | +1. [jQuery 3.2.1](https://jquery.com/) |
16 | 18 | 2. [Bootstrap 3.3.7](https://getbootstrap.com/docs/3.3/) |
17 | 19 |
|
18 | | -## Example files |
| 20 | +Both of jQuery and Bootstrap are distributed under the [MIT license](https://opensource.org/licenses/MIT). Please see more detail in the LICENSE.md file. |
| 21 | + |
| 22 | +## Example files and folders |
19 | 23 | The web application contains the following example files and folder: |
20 | 24 | 1. index.html: The application HTML page |
21 | 25 | 2. app/market_price_app.js: The application main file |
22 | 26 | 3. app/ws_workers.js: The application Web Workers file |
23 | 27 | 4. css/cover.css: The application CSS file |
24 | | -5. libs/jquery-3.2.1.min.js: jQuery library file (need to be downloaded separately) |
25 | | -6. bootstrap/css, bootstarp/fonts and bootstrap/js folders: The folders for Bootstrap CSS and libraries files (need to be downloaded separately) |
| 28 | +5. libs/jquery-3.2.1.min.js: jQuery library file |
| 29 | +6. bootstrap/css, bootstarp/fonts and bootstrap/js folders: The folders for Bootstrap CSS and libraries files |
26 | 30 |
|
27 | 31 | ## How to run this example |
28 | | -1. Deploy the project in any web server |
29 | | -2. Open <web server>/index.html in the web browser (IE11, Chorme and Firefox) |
| 32 | +1. Deploy the project in any web server (recommend [http-server](https://www.npmjs.com/package/http-server) for quick dev/testing) |
| 33 | +2. Open <web server>/index.html in the web browsers (IE11, Chorme and Firefox) |
30 | 34 |
|
31 | 35 | ## References |
32 | 36 | For further details, please check out the following resources: |
33 | 37 | * [Thomson Reuters Elektron WebSocket API page](https://developers.thomsonreuters.com/elektron/websocket-api-early-access) on the [Thomson Reuters Developer Community](https://developers.thomsonreuters.com/) web site. |
34 | 38 | * [Mozilla Developer Network: Web Workers API page](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). |
35 | 39 | * [Google HTML5 Rocks: The Basics of Web Workers page](https://www.html5rocks.com/en/tutorials/workers/basics/) |
| 40 | + |
| 41 | +For any question related to this article or Elektron WebSocket API page, please use the Developer Community [Q&A Forum](https://community.developers.thomsonreuters.com/). |
0 commit comments