refactor: websocket 优化

This commit is contained in:
haoxr
2023-12-14 23:36:41 +08:00
parent cd4f14e643
commit 974f32b268
2 changed files with 6 additions and 13 deletions

View File

@@ -54,7 +54,7 @@ public class WebsocketController {
String receiver = username; // 接收人
log.info("发送人:{}; 接收人:{}", sender, receiver);
// 发送消息给指定用户 /user/{username}/queue/greeting
// 发送消息给指定用户,拼接后路径 /user/{receiver}/queue/greeting
messagingTemplate.convertAndSendToUser(receiver, "/queue/greeting", new ChatMessage(sender, message));
}