Complete solution addressing all focus areas:
Device Shadow Event Handling: The visualization panel needs proper event subscription configuration. Edit your dashboard configuration file (usually dashboard-config.json) and add:
"deviceShadow": {
"eventHandling": {
"enabled": true,
"topics": [
"$aws/things/+/shadow/update/accepted",
"$aws/things/+/shadow/update/delta"
]
}
}
The panel must subscribe to both ‘accepted’ (for reported state confirmations) and ‘delta’ (for state differences) topics. Without these subscriptions, the dashboard doesn’t receive real-time shadow update notifications.
Push vs Polling Updates: The default polling mode is insufficient for real-time visualization. Switch to push-based updates:
"deviceShadow": {
"updateMode": "push",
"fallbackPollInterval": 60000,
"reconnectStrategy": "exponential"
}
Set updateMode to ‘push’ to enable event-driven updates. Keep fallbackPollInterval as a backup mechanism in case the event stream disconnects. The exponential reconnect strategy prevents connection storms if the MQTT broker has issues.
Polling mode (the default) explains why you see updates only after manual page reload - the panel polls every 30 seconds, and if you reload before the next poll cycle, you see stale data.
Dashboard Real-Time Sync: The broader issue is dashboard initialization and event stream lifecycle management. Ensure the shadow visualization panel initializes its event subscriptions AFTER the MQTT connection is established:
// In dashboard initialization code
await mqttClient.connect();
await shadowPanel.subscribeToEvents();
In iod-23, there’s a race condition where panels may initialize before MQTT connects, causing subscription setup to fail silently. The panel then falls back to polling mode without notification.
Implement connection state monitoring:
mqttClient.on('disconnect', () => {
shadowPanel.pauseUpdates();
});
mqttClient.on('connect', () => {
shadowPanel.resubscribeAndRefresh();
});
This ensures the panel resubscribes to shadow events after connection interruptions, maintaining real-time sync.
Additional considerations:
-
Event Filtering: If you have many devices, subscribe to specific device shadow topics rather than wildcard patterns to reduce event volume
-
State Reconciliation: Implement periodic reconciliation (every 5 minutes) to catch any missed events - fetch full shadow state and compare with visualization
-
Delta Generation: Verify your shadow service configuration generates deltas correctly. Some configurations require explicit ‘desired’ state to generate deltas. If you only update ‘reported’ without ‘desired’, no delta is generated.
After implementing these changes, test by updating device shadow state and verifying the visualization panel updates within 1-2 seconds without page reload. Monitor the browser console for shadow update events to confirm subscriptions are working.