Real Time Event Tickers using WebSockets support on Integration Server

WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. Integration Server can act as a WebSocket client endpoint and a WebSocket server endpoint.

When Integration Server acts as a WebSocket server, it hosts a server endpoint that you create using Designer. The server endpoint captures the properties required for callback services for the life cycle of a WebSocket. The endpoint is identified by a path within a server.

When Integration Server acts as a WebSocket client it creates a WebSocket client endpoint. The client endpoint captures information related to connection and the respective callback services thereof. It also connects to the WebSocket server identified by a URI.

Any external WebSocket client application can connects to a WebSocket Server running on Integration Server using server URI.

For more details on WebSocket configurations and usage on Integration Server refer to: http://techcommunity.softwareag.com/pwiki/-/wiki/Main/How+to+configure+WebSockets+on+Integration+Server

Use case: Real time event tickers

Use case description:  Display Real time events generated from Cumulocity device on WebSocket Client Application.

Use case Architecture diagram:

Use case explanation:  An IOT device is connected to Cumulocity environment. All the data from the device can be monitored and analyzed using Cumulocity. Data can be events, measurements, alerts, notifications etc. Software AG Cloud connections (WmCumulocityProvider)” allows connecting to Cumulocity environment from Integration Server. Using different resources available in cloud connector, POST, GET, etc. operations can be performed from Integration Server. 

In this particular use case, a temperature IOT device is connected to Cumulocity pushes real time temperatures in °c for every 5 seconds. The data from the Cumulocity is pulled to Integration Server using Cumulocity cloud connectors. The WebSocket Server endpoint and the listener are created on the same Integration Server. There is a WebSocket client application that is connected to WebSocket Server available on Integration Server. Communication between client and server is handled using WebSocket listener.

When an external client application requests a connection with the server, sessions will be created for both client and server. On a successful connection, the client application sends a request using client session ID for real time temperature data.  On successful request from the client, server will start getting data from Cumulocity using cloud connectors and transfers it to the WebSocket Client application. The received data will be displayed on the client application as real-time event tickers.

Steps to execute the use case:

Step1:  Connect a temperature IOT device or have Simulators on Cumulocity.

Step2: Install below mentioned packages on Integration Server and Enable Cumulocity connectors from IS Admin UI.

Server side package installations:

  • WmCumulocityProvider.zip
  • CumulocityConnectors.zip
  • WSProject.zip

Client side package installations:

  • WSClientApp.zip

To enable Cumulocity connector from IS Admin UI follow:

http://techcommunity.softwareag.com/pwiki/-/wiki/Main/How+to+use+Cumulocity+and+Salesforce+Connector+APIs+on+API+Gateway

Note: We have used the device/simulator IDs on services available in CumulocityConnectors.zip package. Those should be updated on installation of packages.

Step3: Create a WebSocket listener port on Integration Server from Admin UI and Enable it.

Step4: Install WSClientApp.zip in Client IS and go to home page of the package. Below page will be displayed.

Step 5: Provide the WebSocket URI on the UI and Click Connect button. “WebSocket session is created” message appears. This confirms that the Client and Server communication is established. When a connection is established, a sessionID will be created for this particular connection. All data transfer during this connection period will be done using the session IDs created for Client and Server.

Step 6: Click Temperature Button to get the real time temperature from Cumulocity. This data will be keep on changing till we disconnect the communication between Client and Server using Disconnect button.

Step 7: Click New Session Button to create the new session between client and server. Again “WebSocket session is created” message will be displayed.

Step 8: Click “Alarm Status” button to get the Alarm data generated in Cumulocity over the new session created. The first session which is created will be un-altered and the data will be kept on transferred for temperature.

Step 9: Click New Session Button to create the new session between client and server. Again “WebSocket session is created” message will be displayed.

Step 10: Click “Position” button to get the position data generated in Cumulocity over the new session created. The first two sessions which are created will be un-altered and the data will be kept on transferred for temperature and Alarm status.

Step 11:  To terminate the connections between client and server click on “Disconnect” button. Which will close all the sessions which is been created.

WSClientApp.zip (4.36 KB)

WSProject.zip (35.2 KB)

CumulocityConnectors.zip (82.2 KB)

WmCumulocityProvider.zip (215 KB)