Nestjs real time

From HoangNguyen0403/agent-skills-standard · View interactive version

Nestjs real time is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Implement WebSocket gateways with Socket.io and Server-Sent Events endpoints in NestJS. Use when building chat features, live feeds, or choosing between WebSocket and SSE for real-time communication.

How to use this skill

Skill file

Real-Time & WebSockets

**Priority: P1 (HIGH)**

Workflow: Add Real-Time Feature

  1. Choose protocol — WebSocket for bi-directional (chat, collab); SSE for uni-directional (feeds, notifications).
  2. Implement gateway or SSE — Create @WebSocketGateway() or @Sse() controller.
  3. Add auth — Validate JWT in handleConnection() for WebSocket; use standard guards for SSE.
  4. Scale — Add @socket.io/redis-adapter for multi-pod WebSocket; use HTTP/2 for SSE.
  5. Test connections — Verify WebSocket handshake auth rejects invalid tokens; confirm SSE streams data.

SSE Endpoint Example

See implementation examples

WebSocket Gateway with Auth Example

See implementation examples

Protocol Selection

WebSockets Implementation

Scaling (Critical)

Security

Architecture

Anti-Patterns

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.