Adopt the base envelope { eventId, type, timestamp, payload } for every WS message. Build a typed dispatcher in socket/messaging.ts that validates type against a registry and routes to handlers. Reject unknown/unauthenticated events. eventId enables idempotency + resume.
Acceptance criteria:
- All events carry the envelope; malformed events rejected
- Unknown event types are dropped with a logged warning, not a crash
- Handlers registered in one typed table
Adopt the base envelope
{ eventId, type, timestamp, payload }for every WS message. Build a typed dispatcher insocket/messaging.tsthat validatestypeagainst a registry and routes to handlers. Reject unknown/unauthenticated events.eventIdenables idempotency + resume.Acceptance criteria: