Skip to content

v1.4.0 - Performance improvements

Pre-release
Pre-release

Choose a tag to compare

@BytePhilHD BytePhilHD released this 12 Sep 09:39
· 3 commits to master since this release

v1.4.0

Highlights

Clients no longer poll the server. The server now watches Spotify centrally and pushes
updates through the existing WebSocket only when something actually changed. Previously
every client sent a refresh request every 2 seconds, regardless of whether anything had
changed — with 50 guests that was ~25 requests per second for roughly one real change
every 3 minutes.

Changed

  • Push instead of polling: one central Spotify poll per second, broadcast on change only.
    Updates now arrive when they happen instead of up to 2 seconds later.
  • The queue is only polled while at least one client has it open (new queue-subscribe action).
  • No Spotify requests at all when no client is connected or while playback is paused.
  • Search input is debounced by 250 ms instead of firing one Spotify search per keystroke.
  • The Spotify display name is cached instead of being requested for every admin update.
  • Admin actions (play/pause, next, back, new session code) trigger an immediate push.
  • default.cfg now ships webaddress=http://127.0.0.1:80/ for local first-time setup.

Fixed

  • Reconnects stacked refresh timers: setInterval lived inside the socket setup and was
    never cleared, so every reconnect added another timer permanently. Replaced by a single
    reconnect timer with exponential backoff (1s → 15s).
  • The first request for the current track or the queue always returned null.
  • Admin-only fields were written into the shared cache object, which leaked the session
    code and the Spotify display name to regular guests.
  • The orange "already requested" marker never worked — the client read isInQueue /
    played while the server sends inQueue.
  • Concurrent writes to the same WebSocket from the push loop and the message handler could
    throw WritePendingException; writes are now serialized per client.
  • A failed write no longer drops a client whose connection is still open.

Internal

  • New BroadcastService (session registry, poll loop, change detection) and ClientSession.
  • refresh now only delivers the initial state after connecting.