One file serves the page, accepts the socket, and pushes the updates
A live order board for the kitchen: one screen, every order appears the moment it's paid. On most stacks that's a static page, a WebSocket server, a process manager for it, and a reverse proxy that knows about upgrades.
On exec it's board.ts. // @mode worker, // @websocket, // @token kitchen-…. A GET returns the HTML, whose script opens wss://…/board?token=…: the WebSocket URL is the script's own route, not a separate /ws path, and the token gates the upgrade before the handshake completes. The payment webhook POSTs to the same route; that branch of the handler calls ws.broadcast(order) and every open screen redraws. ws.connections.size says how many kitchens are watching.
The reverse proxy, the process manager, and the second server each had one job. One file serves the page, accepts the socket, and pushes the updates.
One file serves the page, accepts the socket, and pushes the updates.