Skip to content

Commit 5c7b58b

Browse files
committed
After disconnection, the button states update correctly, but now the issue is app window does not close automatically.
1 parent 68df5dd commit 5c7b58b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

templates/index.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,9 @@ <h3>Select NPG Device</h3>
316316
lslButton.classList.remove('running');
317317
lslButton.classList.add('not-running');
318318
lslButton.disabled = data.npg_running;
319+
if (!data.lsl_running && !data.npg_running) {
320+
updateAppButtons([]);
321+
}
319322
}
320323

321324
// Update NPG button state
@@ -330,11 +333,15 @@ <h3>Select NPG Device</h3>
330333
npgButton.classList.remove('running');
331334
npgButton.classList.add('not-running');
332335
npgButton.disabled = data.lsl_running;
336+
if (!data.npg_running && !data.lsl_running) {
337+
updateAppButtons([]);
338+
}
333339
}
334340

335341
// Update app buttons when stream stops
336342
if ((data.message && data.message.includes('terminated')) ||
337-
(data.message && data.message.includes('disconnected'))) {
343+
(data.message && data.message.includes('disconnected')) ||
344+
(data.message && data.message.includes('interrupted'))) {
338345
updateAppButtons([]);
339346

340347
// If we're in the NPG popup, update status
@@ -350,15 +357,10 @@ <h3>Select NPG Device</h3>
350357
}
351358

352359
// Update running apps list
353-
if (data.running_apps) {
360+
if (data.running_apps && (data.lsl_running || data.npg_running)) {
354361
updateAppButtons(data.running_apps);
355362
}
356363
};
357-
358-
eventSource.onerror = function() {
359-
console.log("SSE connection error - reconnecting...");
360-
setTimeout(setupEventSource, 1000);
361-
};
362364
}
363365

364366
document.addEventListener('DOMContentLoaded', function() {

0 commit comments

Comments
 (0)