Conversation entity
Conversations represent message threads between users. The entity structure is currently defined but not fully implemented:Conversation.java
Expected structure
Based on common patterns and the existingConversationParticipant entity, a conversation will likely include:
Unique identifier
UUID primary key for each conversation
Participants list
One-to-many relationship with ConversationParticipant
Messages
Collection of messages in the conversation
Metadata
Creation timestamp, last message time, etc.
ConversationParticipant entity
The participant entity links users to conversations with a unique constraint preventing duplicate memberships:ConversationParticipant.java
Participant model features
- Unique constraint
- Many-to-one relationship
- UUID identifier
The
@UniqueConstraint on conversation_id and user_id ensures:- Each user can only be added to a conversation once
- No duplicate participant records
- Database-level integrity enforcement
While the entity is defined, it’s currently commented out pending full implementation. The structure suggests support for both direct messages and group conversations.
WebSocket support for real-time messaging
Real-time messaging will be implemented using WebSocket connections. While not yet active in the codebase, this is a planned feature for instant message delivery.Expected WebSocket architecture
WebSocket message types
The messaging system will likely support these message types:Authentication messages
Authentication messages
Initial handshake to verify JWT token and establish user identity:Response:
Chat messages
Chat messages
Text messages sent between participants:
Typing indicators
Typing indicators
Real-time notifications when users are typing:
Read receipts
Read receipts
Track when messages are read by participants:
Relationship to friendships
Messaging will integrate with the relationship system to ensure users can only message their friends.Access control
Before allowing users to create conversations or send messages, the API will verify:Only users with an
ACCEPTED relationship status can start conversations or send messages to each other. See the Relationships documentation for details on friend requests.Message permissions
- Direct messages
- Group messages
Requirements:
- Both users must have
RelationshipStatus.ACCEPTED - Either user can initiate the conversation
- Both users have equal send/receive permissions
Message persistence
While WebSocket provides real-time delivery, messages will also be persisted to the database for:- Message history retrieval
- Offline message delivery
- Search functionality
- Compliance and moderation
Expected Message entity
Current implementation status
What’s available now
- Entity structure definitions (commented out)
- Database constraints for participants
- Relationship system for access control
What’s coming
- Active Conversation and ConversationParticipant entities
- Message entity for storing chat history
- WebSocket endpoint for real-time messaging
- REST endpoints for conversation management
- Message pagination and search
- Read receipts and typing indicators
Check the repository’s issue tracker or roadmap for updates on messaging feature development. The authentication and relationship systems are already complete and ready to support messaging once implemented.