What problem does it solve?
Real-time features often rely on fragile, insecure, or ad-hoc socket implementations that leak tenant data, expose tokens in URLs, or mix business logic into gateways; this Skill standardizes secure, production-ready WebSocket patterns so servers can push tenant-scoped events reliably without polling.
Core Features & Use Cases
- JWT handshake authentication: enforce token verification during the handshake and store verified user/tenant data in socket.data.
- Tenant room isolation & safe broadcasting: ensure events are emitted only to tenant:<tenantId> rooms to prevent cross-tenant leakage.
- RabbitMQ consumer → broadcast pattern: consume microservice events, ack on success, nack without requeue on failure to avoid poison messages.
- Frontend integration: generate a Next.js client hook with socket.io-client and Zustand store wiring for reconnect and auth error handling.
- Use Case: implement Notifications or Chat where backend microservices publish events to RabbitMQ and the gateway reliably relays them to authenticated tenant clients.
Quick Start
Scaffold a tenant-scoped Notifications WebSocket gateway with JWT handshake auth, a RabbitMQ consumer that broadcasts to tenant rooms, and a Next.js useNotificationsSocket hook integrated with Zustand.