https://gitlab.synchro.net/main/sbbs/-/commit/8e81b18915e67f826af3e0d7
Modified Files:
webv4/root/api/events.ssjs
Log Message:
webv4: events.ssjs: don't declare top-level consts
Keyop reported on IRC #synchronet (2026-10-01):
!JavaScript /sbbs/webv4/root/api/events.ssjs line 13: TypeError:
redeclaration of const keepalive, Request:
/api/events.ssjs?subscribe=nodelist
The web server keeps one JS context (and global object) for the life of
a client connection, so every request on a keep-alive connection runs
in the global left behind by the previous one. Re-running a top-level
"const" declaration in that global throws.
events.ssjs never returned while its client was connected until
7399e3a62d (belly-3-lone, 2026-07-29) bounded the stream's lifetime.
Now, when the stream times out and the EventSource reconnects over the
same connection, the script runs a second time and dies at line 13.
Use "var" for the four top-level declarations. The consts inside the
forEach() callback are function-scoped and unaffected.
Co-Authored-By: Claude Opus 5.5 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net