mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-11-10 18:52:22 +01:00
fix(websocket): listen for echo events to update message metadata in real-time
The backend already emits 'echo' SocketIO events when RX_LOG_DATA arrives with route/path data, but the frontend wasn't listening. Now the frontend handles echo events with a debounced loadMessages() refresh (2s delay) to pick up computed pkt_payload, analyzer_url, hops, and route info. This fixes messages appearing without metadata until manual page refresh. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
e817181261
commit
0e15df430f
1 file changed
+13
@@ -422,6 +422,19 @@ function connectChatSocket() {
|
||||
}
|
||||
});
|
||||
|
||||
// Real-time echo data — refresh messages to pick up route/analyzer metadata
|
||||
let echoRefreshTimer = null;
|
||||
chatSocket.on('echo', (data) => {
|
||||
if (currentArchiveDate) return; // Don't refresh archive view
|
||||
if (data.direction !== 'incoming') return; // Only care about incoming echoes
|
||||
// Debounce: wait for echoes to settle, then refresh once
|
||||
if (echoRefreshTimer) clearTimeout(echoRefreshTimer);
|
||||
echoRefreshTimer = setTimeout(() => {
|
||||
echoRefreshTimer = null;
|
||||
loadMessages();
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
// Real-time device status
|
||||
chatSocket.on('device_status', (data) => {
|
||||
const statusEl = document.getElementById('connectionStatus');
|
||||
|
||||
Reference in new issue
Block a user