profile
Door
More view more view
Recording the apparel supply chain
through shop-floor numbers and data

Sewing Factory IoT War (2) : The Secret Behind a Real-Time-Looking Web

Real-Time Garment Factory Web

Painting a Garment Factory on the Web:
React + API Structure

Real-Time Garment Factory Web

Our garment factory web page isn’t just a simple monitoring tool.

It had to show the movements of thousands of IoT devices in sewing factories
— almost in real time, down to the second.

So we built it as a React-based SPA (Single Page Application),
and used CloudFront and S3 to serve static files.

The Secret Behind the Real-Time Flow

Real-Time Garment Factory Web

Although the screen appears to update in real time, the flow is actually finely tuned and calculated.

The React app uses useEffect to fetch data every few seconds.
API calls follow a structure like:
/api/factory/{id}/line/{n}/status,
requesting data based on the factory ID and line number.

This request is routed through the API Gateway,
then delivered to a NestJS-based ECS container server,
which queries AWS DocumentDB and responds with the data.

On the React side,
tools like useState, useQuery, and swr are used for state management,
with rendering optimized right up to the point of display.

Performance Design for Sewing Data

Not all factory data needs to be real-time.
So we took a differentiated approach based on the importance of the information.

  • Less frequently changing data is cached using CloudFront TTL settings.
  • Some components use WebSocket for reactive updates.
  • Heavy components like dashboards are lazy-loaded to only load when needed.

Hidden Threats in the Wireless Network

Real-Time Garment Factory Web

Our top priority was to prevent data loss and ensure seamless display for all users.

To do this, we focused on three areas:

  1. ECS Auto Scaling: Containers automatically scale with increasing traffic.
  2. Optimized Queries: DocumentDB queries are indexed and fine-tuned for conditional searches.
  3. Smooth UX: React’s async handling and caching were optimized for a natural user flow.

How Did Wi-Fi Sewing Lines Survive?

The real challenge was the wireless network inside the factory.

All IoT devices operate over Wi-Fi.
The issue? Each factory has thousands of devices trying to send data every 1–2 minutes.

At first, we thought, “Wouldn’t adding more APs solve it?”
But the reality on-site wasn’t that simple.

Hidden Threats in the Wireless Network

The problems weren’t just about slower speeds —
they triggered a domino effect:

Problem TypeDescription
Channel CollisionMultiple APs on the same channel caused packet collisions and speed drops.
AP OverloadOver 100 devices on one AP overloaded its queue, causing timeouts.
Retransmission LoopLost packets led to repeated retries → excessive network use → more loss.
Full Line OutageIf one AP failed, hundreds of connected devices went offline.

The Real Solution Found on Site

The conclusion was simple, but the execution was tricky:
“It’s not about more APs — it’s about intentional placement and tuning.”

So we did this:

APs by Sewing Line

  • We placed APs per line or work zone,
  • limiting each AP to 100–150 devices max.

5GHz Only + DFS Channels

  • We used dedicated 5GHz SSIDs and enabled DFS channels to minimize interference.
  • Channel settings were manual, not automatic, and transmission power was adjusted.
  • Rather than widening coverage, we focused on minimizing collisions.

Why We Deliberately Split the Traffic

  • Each device was assigned a different preferred AP,
    spatially distributing connections.
  • We also randomized transmission times (±10–30 seconds) to avoid data spikes.
    → Prevent simultaneous bursts of traffic!

The Magic of Random Timing

The result of this design?

  • Over 99.9% transmission success rate even with thousands of devices
  • If one AP fails, the whole line doesn’t go offline
  • SQS traffic is distributed, preventing system crashes

Better Than True Real-Time

Our system isn’t technically 100% real-time.
But for users, it feels like it is.

This wasn’t the power of a single technology,
but the result of deliberately designing everything — from data flow, API calls, to network distribution.

All of this intentional design is how we digitally connected sewing factories —
by simply making it look like it’s just working.

back icon Back