siegebreak/services/package.json
caelum0x e8e48c28bc feat: real-time WebSocket matchmaking push (replaces poll-only)
Backend: on a match the matcher publishes a match-found event to a
Redis channel; modules/matchmaking/notifier.ts runs a per-instance
subscriber that forwards to locally-connected sockets, so fan-out is
correct across multiple API instances. New WS /matchmaking/subscribe
route (@fastify/websocket) authenticates via ?token= (WS handshakes
can't carry Authorization), registers the socket, and replays the
current ticket on connect to close the queue<->connect race.

Web: openMatchSocket() opens the subscribe socket as an accelerator and
keeps the ~1s poll as the reliable backstop (and the only path where
WebSocket is unavailable, e.g. jsdom). Pure matchSocketUrl builder tested.

10 new backend tests (notifier registry/dispatch/publish, token helper,
WS route registration) + matcher publish assertions; 3 new web tests.
108 backend / 21 web tests green.
2026-07-27 17:46:41 +03:00

42 lines
1.0 KiB
JSON

{
"name": "siegebreak-services",
"version": "0.1.0",
"private": true,
"prisma": {
"schema": "src/db/schema.prisma",
"seed": "tsx src/db/seed.ts"
},
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc",
"start": "node dist/index.js",
"migrate": "prisma migrate dev",
"seed": "prisma db seed",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"test:integration": "vitest run --config vitest.integration.config.ts"
},
"dependencies": {
"@fastify/cors": "^9.0.1",
"@fastify/rate-limit": "^9.1.0",
"@fastify/websocket": "^8.3.1",
"@prisma/client": "^5.18.0",
"fastify": "^4.28.0",
"ioredis": "^5.4.1",
"jose": "^5.10.0",
"jsonwebtoken": "^9.0.2",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/jsonwebtoken": "^9.0.6",
"@types/node": "^20.14.0",
"@vitest/coverage-v8": "^2.1.0",
"prisma": "^5.18.0",
"tsx": "^4.16.0",
"typescript": "^5.5.0",
"vitest": "^2.1.0"
}
}