Package vaultWeb.controllers
Class ChatController
java.lang.Object
vaultWeb.controllers.ChatController
Controller responsible for handling WebSocket-based chat functionality.
Supports both group chat and private messages. Messages are first persisted via ChatService and then dispatched to the corresponding topics or users.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsendMessage(ChatMessageDto messageDto) Handles incoming group chat messages from clients and broadcasts them to all subscribers of the specified group topic.voidsendPrivateMessage(@Valid ChatMessageDto messageDto) Handles incoming private chat messages from clients and sends them to both users of the private chat.
-
Constructor Details
-
ChatController
public ChatController()
-
-
Method Details
-
sendMessage
Handles incoming group chat messages from clients and broadcasts them to all subscribers of the specified group topic.- Parameters:
messageDto- DTO containing message content, sender information, and target group
-
sendPrivateMessage
@MessageMapping("/chat.private.send") public void sendPrivateMessage(@Valid @Payload @Valid ChatMessageDto messageDto) Handles incoming private chat messages from clients and sends them to both users of the private chat. The message content is decrypted before delivery.- Parameters:
messageDto- DTO containing message content, sender information, and private chat ID
-