Express static (public/+build/); WebSocketServer noServer + maxPayload (L5); upgrade gate: path!=wsPath->destroy, bad origin->401, else handleUpgrade (L3); connection waits attach, handleAttach in try/catch -> exit(-1)+close on spawn fail (M4); message routes input/resize; close->detach (never kill); SIGINT/TERM ->shutdown; reapIdle timer; safeSend guards readyState (M5). tsc clean.