Websocket Realtime Data Example
In this example, we'll test the Realtime Data Websocket API functionality. We will go through the Chronicall setup required to connect to a specific Realtime metric and show you where you can test that the websocket is working.
Create a Service User
Within Chronicall, create a new Service User. This will provide us with an authentication key.
- Create a new user in User Management > User Accounts.
- Click the User drop-down menu and select .
- Enter a name in the Name field and select the "Service User" option at the bottom.
- Save your changes.
Once completed, you will find the authentication key within API Enablement > Service Users.
Configure a Realtime Data Access Report
Within Chronicall, we will configure a Realtime metric to be used via the Realtime Data Access API. In this example we will be using the "Do Not Disturb Count" metric.
- Start by going to API Enablement > Realtime Metric Access.
- Give your metric a name; we will use MyMetric.
- Select a Metric Category.
- Select a Realtime Metric.
- In the Service Account section, select the service account you created earlier.
- Note that a custom Metric ID string was generated. This will be used later.
- Press OK.
Test Websocket Access
You my use any method you like to test your web socket. In this test. we will use websocket.org.
Please note that Xima Software does not develop or provide technical support for websocket.org. websocket.org is simply a free and easy-to-use site for testing purposes.
Configure the Connection
Within websocket.org, replace the URL in Location with:
ws://localhost:9080/rest/api/v1/realtime-metric-subscription?id={MetricId}&auth_token={AuthenticationKey}
The "MetricId" is the metirc ID from above within Chronicall. (API Enablement > Realtime Metric Access)
The "AuthenticationKey" can be found in within Chrnoicall. (API Enablement > Service Users)
For example, we are using ws://localhost:9080/rest/api/v1/realtime-metric-subscription?id=KEMBXA3V&auth_token=ODIxZjkwNGEtYTE5NS02ZDc2LTlkOGItMTBjOTg4MTc0OTU5dzlkOGIxMGM5LTg4MTctNDk1OS04MjFmLTkwNGFhMTk1NmQ3Nnc2Mjc0ZWYzNi03N2U4LWI2YTctN2RlMC02ZmI1NWU2YTkyPGE=
We are now ready to attempt a connection. Click on Connect within websocket.org. You will see the resulting response below in the Log field.
Updated about 4 years ago