[feat](trx-frontend-http): show distinct connection loss messages in UI
When the SSE stream drops (onerror or 15s heartbeat timeout) show "trx-client connection lost, retrying…". When the stream is live but server_connected is false, show "trx-server connection lost". Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -3103,7 +3103,9 @@ function connect() {
|
||||
lastRendered = evt.data;
|
||||
render(data);
|
||||
lastEventAt = Date.now();
|
||||
if (data.initialized) {
|
||||
if (data.server_connected === false) {
|
||||
powerHint.textContent = "trx-server connection lost";
|
||||
} else if (data.initialized) {
|
||||
powerHint.textContent = readyText();
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -3122,7 +3124,7 @@ function connect() {
|
||||
es.onerror = () => {
|
||||
// Check if this is an auth error by looking at readyState
|
||||
if (es.readyState === EventSource.CLOSED) {
|
||||
powerHint.textContent = "Disconnected, retrying…";
|
||||
powerHint.textContent = "trx-client connection lost, retrying\u2026";
|
||||
es.close();
|
||||
pollFreshSnapshot();
|
||||
scheduleReconnect(1000);
|
||||
@@ -3132,6 +3134,7 @@ function connect() {
|
||||
esHeartbeat = setInterval(() => {
|
||||
const now = Date.now();
|
||||
if (now - lastEventAt > 15000) {
|
||||
powerHint.textContent = "trx-client connection lost, retrying\u2026";
|
||||
es.close();
|
||||
pollFreshSnapshot();
|
||||
scheduleReconnect(250);
|
||||
|
||||
Reference in New Issue
Block a user