Real-time data handling in shop floor control API for am-2023.1 production monitoring

We’re building a real-time production monitoring dashboard that consumes data from the shop floor control API in am-2023.1. The dashboard needs to display current machine status, work order progress, and quality alerts with minimal latency.

Our current approach polls the API every 5 seconds, but this creates noticeable lag and puts significant load on the MES server. We’re exploring streaming APIs or WebSocket connections for push-based updates, but I’m not sure if am-2023.1 supports these patterns natively.

Data consistency is also a concern - when multiple operations update the same work order simultaneously, we occasionally see conflicting state in the API responses. How are others handling real-time data requirements while maintaining consistency? Are there specific API endpoints or patterns designed for low-latency production monitoring?

Latency optimization tip - use the include parameter to fetch related entities in a single request rather than making multiple calls. For example, get work order details with machine assignments and material consumption in one API call. This reduces round trips and improves perceived performance. Also enable HTTP/2 on your API gateway if you haven’t already - it handles multiple concurrent requests much more efficiently.

The SSE endpoint is exactly what we needed. Initial tests show sub-second latency for machine status events. Question about the version tokens - if we detect a conflict (stale etag), what’s the recommended recovery pattern? Should we refetch the current state and retry the update, or prompt the user to resolve the conflict manually?

We implemented a hybrid approach - SSE for critical real-time events like machine status changes and quality alerts, with periodic polling every 30 seconds for aggregate data like work order progress. This balances latency and server load. For data consistency, we use optimistic locking with version tokens. Each API response includes an etag header that must be sent back on updates to ensure you’re modifying the current state.

For automated processes like dashboard updates, refetch and retry with exponential backoff. For user-initiated actions like manual status changes, show a conflict notification and let them decide. We display a diff of what changed between their view and current state. Most conflicts resolve automatically on retry since shop floor operations are typically sequential rather than truly concurrent.

The shop floor control API doesn’t natively support WebSockets in am-2023.1, but you can use Server-Sent Events (SSE) for push-based updates. MES publishes production events to an event stream that you can subscribe to. This eliminates polling and reduces latency to under 500ms for most events. Check the API documentation for the /events/stream endpoint.