30 lines
1.3 KiB
Markdown
30 lines
1.3 KiB
Markdown
# WebSocket Chat - Implementation Tasks
|
|
|
|
## Task 1: Add Redis configuration
|
|
- **ID**: ws-1-config
|
|
- **Status**: pending
|
|
- **Blocked By**: none
|
|
- **Files**: `services/chat-api/internal/config/config.go`, `services/chat-api/.env.example`
|
|
- **Scope**: Add `RedisURL` field to Config struct. Add `REDIS_URL` to .env.example.
|
|
|
|
## Task 2: Wire up Hub, Redis broadcaster, and WebSocket handler in main.go
|
|
- **ID**: ws-2-main-wiring
|
|
- **Status**: pending
|
|
- **Blocked By**: ws-1-config
|
|
- **Files**: `services/chat-api/cmd/server/main.go`
|
|
- **Scope**: Create Redis client, LocalHub, RedisBroadcaster, and realtime.Handler. Start hub and broadcaster goroutines. Pass handler to RegisterRoutes. Register shutdown hooks.
|
|
|
|
## Task 3: Mount WebSocket routes
|
|
- **ID**: ws-3-routes
|
|
- **Status**: pending
|
|
- **Blocked By**: ws-2-main-wiring
|
|
- **Files**: `services/chat-api/internal/api/routes.go`, `services/chat-api/internal/api/spec.go`
|
|
- **Scope**: Update RegisterRoutes to accept realtime.Handler. Mount WebSocket handler at `/api/chat-api/ws`. Add WebSocket endpoint to OpenAPI spec.
|
|
|
|
## Task 4: Add WebSocket handler test
|
|
- **ID**: ws-4-tests
|
|
- **Status**: pending
|
|
- **Blocked By**: ws-3-routes
|
|
- **Files**: `services/chat-api/internal/api/handlers/ws_test.go`
|
|
- **Scope**: Test WebSocket upgrade, message send/receive, and hub broadcast.
|