HMI Communication - IDEA

The 3 HMIs developed by IDEA for the 3 Use Cases of the TeamingAI project are different because they have been appropriately designed for each of the Use Cases, but they are all web apps whose Front-End was created in Javascript using the Agular framework. The software infrastructure has a common architecture for all use cases, and data exchange between Front-End and Back-End it takes place on the HTTP protocol via JSON and is based on URL endpoints that expose both REST and WebSocket APIs. In particular, the WebSocket API’s allow the visualization of the data acquired from the shopfloor in real time via the Kafka event broker, while both historical data and prediction are managed via REST API. The HMI’s technologies used to manage communication between Front-End and Back-End are described below.

 

API

API is the acronym for "Application Programming Interface", where the word "application" refers to any software developed to have a specific functionality. APIs are mechanisms that allow two software components to communicate with each other using a set of definitions and protocols. You can think of the API as the interface that defines how various types of software communicate with each other using requests and responses and contains information on how developers they must structure these requests and responses.

The API architecture can be illustrated in terms of client and server, where the application that sends the request is called the client and the application that sends the response is called the server. As listed below, APIs can work in four different ways based on data exchange protocols and context.

SOAP API

These APIs use the Simple Object Access Protocol (SOAP). Clients and servers exchange messages via XML. This is a less flexible type of API, which was more widespread in the past.

 

RPC API

These APIs are called Remote Procedure Calls. The client completes a function (or procedure) on the server, and the server sends the output to the client.

 

WebSocket API

The WebSocket API is another development of the modern web API that uses JSON objects to transfer data. A WebSocket API supports two-way communication between client apps and the server.

The server can send callback messages to connected clients improving efficiency.

GRAPHQL API

It’s a query language used in combination with various databases, both NoSQL and relational.

REST API

These are the most popular and flexible APIs on the web today. The client sends requests to the server as data. The server uses this client input to select functions internal to use, and returns the output data to the client.

The various types of APIs all work differently, but their purpose is always the same: to facilitate communication between different software entities.

The REST APIs and WebSocket APIs are explained below in more detail as they are the ones used for TeamingAI.

REST stands for "Representational State Transfer" and defines a number of functions like GET, PUT and DELETE that clients can use to access server data. Clients and servers exchange data via HTTP. The main characteristic of the REST API is the absence of state. Stateless means that servers do not save client data between requests. The requests sent by the client to the server are similar to the URLs that are typed into the browser to visit a website. The response from the server is plain data, without the graphic rendering typical of a web page.

REST APIs offer four main benefits:

1. Integration

APIs are used to integrate new applications with existing software systems. This increases development speed because each feature does not have to be written from scratch. You can use APIs to leverage existing code.

2. Innovation

With the arrival of a new app, entire sectors can change. Businesses must respond quickly and support the rapid deployment of innovative services. They can do this by making changes at the API level without having to rewrite the entire code.

3. Expansion

APIs represent a unique opportunity for companies to respond to customer needs across different platforms. For example, the Maps API allows the integration of map information via websites, Android, iOS etc. Any company can provide such access to its internal databases using free or paid APIs.

4. Easy maintenance

The API acts as a gateway between two systems. Each system is forced to make internal changes so that the APIs are not affected. This way, any changes future code on one side will not have any influence on the other side.

Within each API it is possible to identify an endpoint. API endpoints are the final touchpoints in the API's communication system, and they are used to send and receive information between systems. An API endpoint is a digital entity exposed via the API, through which the API receives requests and sends responses. These include server URLs, services, and other specific digital locations. An API is a set of protocols and tools to facilitate interaction between two applications. An endpoint is that part of the API where the exchange takes place, without which it would not be possible to interact with the API. In fact, endpoints are also called the URIs (Uniform Resource Identifiers) of a particular API that an application can access. API endpoints are very important in terms of performance because, in case of high traffic, they could cause bottlenecks, significantly slowing down an entire system.

WebSocket

Technically speaking, a WebSocket is a persistent, bi-directional full-duplex TCP connection, secured by a client-key handshaking system and a security model origin-based. The system also masks data transmissions to prevent sniffing of plaintext packets. WebSockets provide real-time bidirectional communication between clients and servers that are always connected, and can exchange both data and events even at the same time without collisions or malfunctions.

The client sends a base64-encoded 16-byte secret key to the server. The server then adds a string, also called "magic string" and sends back the result, processed with SHA1, to the client. In this way, the client can be sure that the server to which he sent his key is the same one that opens the connection. The origin of the WebSocket request is verified by the server to determine that it comes from an authorized domain. The server may reject socket connections from untrusted domains. Furthermore, to increase the level of security of communication, the client sends a 4-byte key for obfuscation in the initial frame of each message. It is used to perform a bitwise XOR between data and key. This helps to prevent data sniffing, since an attacker should be able to determine the start byte of the message to be able to decrypt it.

In particular, the WebSocket API in JavaScript is simple and at the same time powerful as it defines an object that contains the following:

  • Connection status information (connecting, open, closing and closed)

  • Methods for interacting with WebSocket connection (closing a connection and sending data)

  • Events that are raised when a WebSocket event occurs (when a socket is opened, closed, or receives an error message in response).

Like the REST API, the WebSocket API also exposes an endpoint for communication.

The use of WebSockets is advantageous in various types of software architectures as they are certainly more efficient and performing than polling. Furthermore, they reduce latency, simplify real-time applications, and do not require message headers, reducing bandwidth. Typical WebSocket applications consist of multiplayer games, chat applications, financial applications, social networking, and operational document editing.

Previous
Previous

Teaming.ai goes to Automation & Robotics Expo

Next
Next

Enhancing Manufacturing Processes by a Digital Shadow through KG-Enhanced BPMN Model Executions