[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;
|
lastRendered = evt.data;
|
||||||
render(data);
|
render(data);
|
||||||
lastEventAt = Date.now();
|
lastEventAt = Date.now();
|
||||||
if (data.initialized) {
|
if (data.server_connected === false) {
|
||||||
|
powerHint.textContent = "trx-server connection lost";
|
||||||
|
} else if (data.initialized) {
|
||||||
powerHint.textContent = readyText();
|
powerHint.textContent = readyText();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -3122,7 +3124,7 @@ function connect() {
|
|||||||
es.onerror = () => {
|
es.onerror = () => {
|
||||||
// Check if this is an auth error by looking at readyState
|
// Check if this is an auth error by looking at readyState
|
||||||
if (es.readyState === EventSource.CLOSED) {
|
if (es.readyState === EventSource.CLOSED) {
|
||||||
powerHint.textContent = "Disconnected, retrying…";
|
powerHint.textContent = "trx-client connection lost, retrying\u2026";
|
||||||
es.close();
|
es.close();
|
||||||
pollFreshSnapshot();
|
pollFreshSnapshot();
|
||||||
scheduleReconnect(1000);
|
scheduleReconnect(1000);
|
||||||
@@ -3132,6 +3134,7 @@ function connect() {
|
|||||||
esHeartbeat = setInterval(() => {
|
esHeartbeat = setInterval(() => {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (now - lastEventAt > 15000) {
|
if (now - lastEventAt > 15000) {
|
||||||
|
powerHint.textContent = "trx-client connection lost, retrying\u2026";
|
||||||
es.close();
|
es.close();
|
||||||
pollFreshSnapshot();
|
pollFreshSnapshot();
|
||||||
scheduleReconnect(250);
|
scheduleReconnect(250);
|
||||||
|
|||||||
Reference in New Issue
Block a user