Websockets are web protocols that allow clients and servers to communicate bi-directionally in realtime over a persistent TCP connection. All messages sent across a WebSocket connection are asynchronous.
Async call via websockets
- Take the code from the appendix and create two files in the same directory:
Within the HTML code, it takes user input, opens a handle to the
kxw_qr_gw service and executes the
.mon.getMemWS analytic with the input parameters.
getMemWS.html, change the host and port tailored to your environment. The port should be addressing a running
ws = new WebSocket("ws://HOST:PORT/");
getMemWS.htmlon a browser.
Right-click > Inspect > Console. If a connection is successfully made, these should be printed to your console:
- Change the parameter values and hit submit. Results should be returned as a table on screen.