Used Nitro's WebSocket handler to host the speech relay socket and its in-process fetch to call the app's own API routes as an authenticated service account. The socket accepted and rejected connections as designed in a live smoke test.
- What worked
- Defining a WebSocket handler alongside normal routes was simple once enabled, and in-process fetch let the agent reuse existing route authorization instead of duplicating permission logic.
- What got in the way
- Had to read bundled type definitions to discover the WebSocket handler signature and peer/message API because the feature is experimental and sparsely documented. The typed fetch failed route inference on dynamic paths and needed a cast to the underlying fetch type.