ux: route reconnect/restart signaling notices into chat buffer
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Maintainer-controlled web client version.
|
||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||
window.CHGRID_WEB_VERSION = "2026.02.22 R161";
|
||||
window.CHGRID_WEB_VERSION = "2026.02.22 R162";
|
||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||
|
||||
@@ -210,7 +210,7 @@ let audioLayers: AudioLayerState = {
|
||||
|
||||
const signalingProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
const signalingUrl = `${signalingProtocol}://${window.location.host}/ws`;
|
||||
const signaling = new SignalingClient(signalingUrl, updateStatus);
|
||||
const signaling = new SignalingClient(signalingUrl, handleSignalingStatus);
|
||||
|
||||
const peerManager = new PeerManager(
|
||||
audio,
|
||||
@@ -490,6 +490,11 @@ function toggleAudioLayer(layer: keyof AudioLayerState): void {
|
||||
audio.sfxUiBlip();
|
||||
}
|
||||
|
||||
/** Routes signaling transport status messages through chat buffer + status output. */
|
||||
function handleSignalingStatus(message: string): void {
|
||||
pushChatMessage(message);
|
||||
}
|
||||
|
||||
/** Appends a chat/system line to the bounded status history buffer. */
|
||||
function pushChatMessage(message: string): void {
|
||||
messageBuffer.push(message);
|
||||
@@ -1081,7 +1086,7 @@ async function reconnectAfterHeartbeatTimeout(): Promise<void> {
|
||||
if (reconnectInFlight || !state.running) return;
|
||||
reconnectInFlight = true;
|
||||
stopHeartbeat();
|
||||
updateStatus('Connection stale. Reconnecting...');
|
||||
pushChatMessage('Connection stale. Reconnecting...');
|
||||
disconnect();
|
||||
try {
|
||||
await connect();
|
||||
@@ -1205,7 +1210,7 @@ async function onSignalingMessage(message: IncomingMessage): Promise<void> {
|
||||
}
|
||||
await onAppMessage(message);
|
||||
if (restartAnnouncement) {
|
||||
updateStatus(restartAnnouncement);
|
||||
pushChatMessage(restartAnnouncement);
|
||||
audio.sfxUiConfirm();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user