- Add hub_test.go: register/unregister, join/leave room, broadcast, exclude sender, send to user, multiple clients same user (6 tests) - Add handler_messages_test.go: send message, missing fields, edit ownership check, soft delete (4 tests) - Add handler_realtime_test.go: typing broadcast, read receipts, reactions add/remove, delivered status (5 tests) - Add e2e_chat_ws_test.go: auth valid, missing token, invalid token, ping/pong - Add e2e_chat_messages_test.go: 2-client message flow, typing indicator - Create CHAT_FEATURE_PARITY.md: 25-feature checklist (all OK or IMPROVED)
56 lines
3.2 KiB
Markdown
56 lines
3.2 KiB
Markdown
# Chat Feature Parity: Rust vs Go
|
|
|
|
**Date**: 2026-02-22
|
|
**Version**: v0.502
|
|
**ADR**: [ADR-002-chat-server.md](adr/ADR-002-chat-server.md)
|
|
|
|
## Feature Checklist
|
|
|
|
| # | Feature | Rust (veza-chat-server) | Go (veza-backend-api) | Status |
|
|
|---|---------|------------------------|----------------------|--------|
|
|
| 1 | WebSocket connection | Axum + tokio-tungstenite | coder/websocket + Gin | OK |
|
|
| 2 | JWT authentication (query param) | Custom jwt_manager.rs | ChatService.ValidateChatToken | OK |
|
|
| 3 | SendMessage | websocket/handler.rs | handler_messages.go | OK |
|
|
| 4 | EditMessage | websocket/handler.rs | handler_messages.go | OK |
|
|
| 5 | DeleteMessage (soft delete) | websocket/handler.rs | handler_messages.go | OK |
|
|
| 6 | JoinConversation | websocket/handler.rs | handler_rooms.go | OK |
|
|
| 7 | LeaveConversation | websocket/handler.rs | handler_rooms.go | OK |
|
|
| 8 | FetchHistory (cursor) | websocket/handler.rs | handler_history.go | OK |
|
|
| 9 | SearchMessages (ILIKE) | websocket/handler.rs | handler_history.go | OK |
|
|
| 10 | SyncMessages (since) | websocket/handler.rs | handler_history.go | OK |
|
|
| 11 | Typing indicators | typing_indicator.rs | handler_realtime.go | OK |
|
|
| 12 | Read receipts | read_receipts.rs | handler_realtime.go | OK |
|
|
| 13 | Delivered status | delivered_status.rs | handler_realtime.go | OK |
|
|
| 14 | Reactions (add/remove) | reactions.rs | handler_realtime.go | OK |
|
|
| 15 | CallOffer (WebRTC relay) | websocket/handler.rs | handler_calls.go | OK |
|
|
| 16 | CallAnswer (WebRTC relay) | websocket/handler.rs | handler_calls.go | OK |
|
|
| 17 | ICECandidate (WebRTC relay) | websocket/handler.rs | handler_calls.go | OK |
|
|
| 18 | CallHangup | websocket/handler.rs | handler_calls.go | OK |
|
|
| 19 | CallReject | websocket/handler.rs | handler_calls.go | OK |
|
|
| 20 | Ping/Pong keepalive | websocket/handler.rs | handler.go + client.go | OK |
|
|
| 21 | Rate limiting | security/rate_limiter.rs | rate_limiter.go | OK |
|
|
| 22 | Permissions (read/send/join/moderate) | permissions.rs | permissions.go | OK |
|
|
| 23 | Multi-instance broadcast | N/A (single instance) | ChatPubSubService (Redis) | IMPROVED |
|
|
| 24 | Message attachments | websocket/handler.rs | handler_messages.go (metadata JSONB) | OK |
|
|
| 25 | ActionConfirmed responses | websocket/handler.rs | handler*.go | OK |
|
|
|
|
## Protocol Compatibility
|
|
|
|
- All 19 incoming message types preserved (same `type` field strings)
|
|
- All 20 outgoing message types preserved (same `type` field strings)
|
|
- JSON field names identical to Rust implementation
|
|
- UUIDs as strings, datetimes as ISO 8601 (RFC3339)
|
|
|
|
## Improvements Over Rust
|
|
|
|
1. **Multi-instance support**: Redis PubSub enables horizontal scaling (Rust was single-instance)
|
|
2. **Shared authentication**: Uses the same JWT secret as the backend API (Rust had separate config)
|
|
3. **Unified deployment**: Single binary, no separate container needed
|
|
4. **GORM persistence**: Consistent with rest of the Go backend (Rust used raw SQLx)
|
|
5. **In-memory fallback**: PubSub and rate limiter work without Redis for development
|
|
|
|
## Missing from Rust (intentionally not ported)
|
|
|
|
- Prometheus metrics endpoint on separate port (handled by Go backend global metrics)
|
|
- Custom presence tracking module (simplified to hub.IsUserOnline)
|
|
- Separate health check endpoint (covered by backend /api/v1/health)
|