#2319·mopidy

Move the /mopidy/ws WebSocket to the ASGI app

Author: jodalCreated Sep 27, 2026Updated Sep 27, 2026
LabelsA-ext-httpready-for-agent

:robot: Summary

The /mopidy/ws WebSocket runs in Mopidy's internal mopidy ASGI app, next to JSON-RPC. It sends the same core events and accepts the same JSON-RPC messages as before. Core events come from the actor thread, so schedule the broadcast on the HTTP frontend's event loop in a thread-safe way, as today. See "Event broadcast" in the parent spec.

After this ticket, Mopidy's own endpoints have no Tornado handlers.

Parent

mopidy/mopidy#2312

Acceptance criteria

  • /mopidy/ws sends the same events and accepts the same JSON-RPC messages as before.
  • The same origin checks apply to /mopidy/ws as before.
  • Events from the actor thread reach all connected clients, and a slow or closed client does not break the broadcast to the others.
  • Core calls do not block the event loop.
  • The existing WebSocket tests pass without changes to their assertions.

Blocked by

  • mopidy/mopidy#2315
  • mopidy/mopidy#2318