Fix web map blanking and websocket dropping behind a reverse proxy

- web-map: main() was bound to the whole site state, so every state
  update (e.g. each player position update over the websocket)
  re-rendered the page and re-attached the Leaflet map to a new
  element, blanking the tiles. Only re-render when the view, server
  list, or map instance changes.
- web-map: reconnect the websocket when it closes, instead of silently
  stopping live updates.
- events-server-web: send websocket pings every 30s, so idle
  connections aren't closed by reverse proxies (nginx defaults to a
  60s read timeout).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lazzexus 2026-10-12 18:09:03 +02:00
parent e52ea9d9cf
commit d023ec61d9
3 changed files with 26 additions and 7 deletions

View file

@ -13,6 +13,9 @@ fun Application.webmapWebsocketServer(
wsServer: WebmapWebsocketServer,
) {
install(WebSockets) {
// keep idle connections alive through reverse proxies (e.g. nginx closes after 60s by default)
pingPeriodMillis = 30_000
extensions {
install(WebSocketDeflateExtension) {
// Compression level to use for java.util.zip.Deflater