preview.nvim/lua/preview
Barrett Ruth 2888c5bb09
fix(reload): bind SSE server to port 0 for OS-assigned port
Problem: the SSE reload server hardcoded port 5554, causing silent
failure when that port was already in use. bind() would fail but its
return value was never checked; listen() would also error and silently
drop via the if err then return end guard. inject() still wrote the
dead EventSource URL into the HTML, so the browser would connect to
whatever was on 5554 — or nothing — and live reload would silently
stop working.

Solution: bind to port or 0 so the OS assigns a free port, then call
getsockname() after bind to capture the actual port into actual_port.
inject() reads actual_port in preference to the hardcoded constant,
and stop() resets it. PORT = 5554 is kept only as a last-resort
fallback in inject() if actual_port is unset.
2026-03-03 17:41:53 -05:00
..
commands.lua feat: unified reload field for live-preview (SSE + long-running watch) (#19) 2026-03-03 16:41:47 -05:00
compiler.lua feat: unified reload field for live-preview (SSE + long-running watch) (#19) 2026-03-03 16:41:47 -05:00
diagnostic.lua fix(presets): correct error parsers for real compiler output (#11) 2026-03-03 14:14:59 -05:00
health.lua feat: rename watch → toggle, auto-compile on start, built-in opener 2026-03-02 23:37:44 -05:00
init.lua feat: unified reload field for live-preview (SSE + long-running watch) (#19) 2026-03-03 16:41:47 -05:00
log.lua feat: rename 2026-03-02 21:23:40 -05:00
presets.lua feat: unified reload field for live-preview (SSE + long-running watch) (#19) 2026-03-03 16:41:47 -05:00
reload.lua fix(reload): bind SSE server to port 0 for OS-assigned port 2026-03-03 17:41:53 -05:00