📡 REST API Endpoints
Messages
Get message history between two users (requires authentication)
Query Params: user_id, other_user_id, limit (optional, default: 50)
Get all messages for a specific user (requires authentication)
Query Params: limit (optional, default: 100), source (optional)
Activity & Status
Get user activity status (active, last_seen) 🔒 Requires Authorization
Headers: Authorization: Bearer <token>, X-Source: <source>
Response: { success, user_id, is_active, last_seen, typing_to_user_id }
Update current user's activity status 🔒 Requires Authorization
Headers: Authorization: Bearer <token>, X-Source: <source>
Body: { is_active: true/false }
⚠️ Authorization: User can only update their own activity status
Mark messages as seen 🔒 Requires Authorization
Headers: Authorization: Bearer <token>, X-Source: <source>
Body: { other_user_id: 123 }
System
Health check endpoint
🔌 Socket.IO Events
Client → Server 🔒 All require Socket.IO authentication
Send a message to another user 🔒 Authenticated
Auth: Token and source passed via socket.handshake.auth
Request message history between current user and another user 🔒 Authenticated
Mark messages from another user as seen 🔒 Authenticated
Send typing indicator (is_typing: true to start, false to stop) 🔒 Authenticated
Server → Client
Receive a message (sent to both sender and receiver)
Receive message history in response to get_message_history
Notification that messages were seen by recipient
Notification that a user is typing
Notification about user activity status change
Confirmation that messages were marked as seen
Error occurred during operation
🔐 Authentication
All API endpoints require Bearer token authentication via Authorization header:
Example Request:
⚠️ Without valid Authorization header, all requests will return 401 Unauthorized
📚 Full Documentation
See API_DOCUMENTATION.md for complete API documentation.