WebSocket server: attach ws upgrade to Express #33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Multiplayer requires real-time bidirectional communication. The project uses the
wslibrary (not Socket.io) — seedocumentation/decisions.md.What to do
Attach a WebSocket upgrade handler to the existing Express HTTP server.
Files to change
apps/api/src/server.ts— changeapp.listen()to usecreateServer(app). Attachws.Servervia theupgradeevent.apps/api/src/ws/index.ts— new file. WebSocket server setup.apps/api/package.json— addwsand@types/ws.Implementation outline
Acceptance criteria
wss://api.lilastudy.comNotes
Caddy automatically proxies WebSocket connections — no config change needed. When Caddy sees an
Upgrade: websocketheader, it forwards it.