Indice dei contenuti
ToggleArticle by Andrea Mengato – Full Stack Developer at AzzurroDigitale
Discover how WebSockets transform web applications by enabling real-time notifications and instant updates. In manufacturing, this reduces machine downtime and improves coordination between operators and systems, boosting operational efficiency through persistent, targeted communication channels.
In traditional web applications, the flow of information is often one-way or requires explicit user action: clicking a button or refreshing the page to see new data. However, in dynamic contexts such as the manufacturing sector, information needs to move in real time.
When are WebSockets needed?
WebSockets are the enabling technology for any scenario where timeliness is critical. Imagine a production line: if a machine raises an alert, the operator needs to know the exact moment it happens, without manually refreshing their tablet. WebSockets allow the server to push data to the client (the tablet or browser) proactively, eliminating downtime.
For manufacturing companies, this translates into a drastic reduction in reaction times. It’s not just about “seeing data sooner,” but about enabling instant coordination between machines, software, and operators, reducing machine downtime and improving resource management on the factory floor.
Practical value for factory workers:
- Reduced machine downtime
- Immediate response to faults or anomalies
- Instant coordination between machines and operators
- Reduced errors caused by outdated information
HTTP vs. WebSocket
To understand the revolution of WebSockets, think of the difference between a letter and a phone call.
- HTTP (The classic model): It’s like sending a letter. The client (sender) sends a request, the server (recipient) receives it, processes it, and responds. Once the response is received, the conversation ends. If you want to know about any updates, you have to send another letter.
- WebSocket: It’s like a phone call. Once the connection is established, the line stays open. Both parties can talk (send data) at any time, in both directions, without having to dial again.

The concept of an “open channel”
Technically, a persistent tunnel is created between the frontend and the backend. This channel is “full-duplex,” meaning data can travel simultaneously in both directions. There’s no need to ask, “Are there any updates?”—the server notifies you as soon as they happen.
Pros and Cons of WebSockets
- Pros (Efficiency and Speed): Ideal for chat, monitoring dashboards, live notifications, and gaming. Network load is reduced because data is sent only when needed.
- Cons (State Management): Unlike a REST API call, which is “stateless” (has no memory), WebSockets are “stateful.” The server must know exactly who is connected and keep the connection active. This requires a robust backend architecture to handle multiple open connections simultaneously without crashing.
WebSockets at AzzurroDigitale
Our approach: WebSocket + Redis
Working on custom projects for the manufacturing sector, we faced the challenge of communicating with specific operators based on their physical location. We didn’t want to send a “broadcast” message to everyone (risking confusion), but only to those at a specific workstation or to a specific operator.
Practical Implementation
We implemented an architecture that combines the speed of WebSockets with the power of Redis1 as a fast store for temporary information. Here’s how the flow we designed works:

- Connection and Identification: When an operator powers on the tablet and connects, we establish a WebSocket connection. At that moment, the tablet is assigned a unique Socket ID.
- Mapping in Redis: The technical ID alone isn’t enough. We store an object in Redis that links the
Socket IDto the business information: theStaff ID(who the operator is).
- Precise Targeting: When the backend needs to communicate a fault or a task, it doesn’t “shout” to everyone. It queries Redis asking: “Give me the Socket ID of the operator working at Station B.”
- Delivery: Once the ID is retrieved, the server sends the message exclusively to that tablet via the open WebSocket channel.
WebSockets, combined with tools like Redis, enable web applications to become true real-time applications, essential in manufacturing contexts. It’s not just technology: it’s operational efficiency, reduced downtime, and greater control over production.
- Redis (REmote DIctionary Server) is an ultra-fast, open-source in-memory database, primarily used as a cache or message broker. It stores data directly in RAM (main memory) rather than on disk, allowing responses in just a few microseconds. It operates on a key-value model, making it ideal for speeding up applications, managing sessions, or handling leaderboards. ↩︎