聊天室

This commit is contained in:
曹磊 2024-08-30 14:08:34 +08:00
parent 6e66ec9e63
commit c5880bf619
1 changed files with 2 additions and 1 deletions

View File

@ -140,7 +140,8 @@ public class AppChatSocket {//用户聊天
// }
List<ChatContent> toUsers = chatContentService.selectUserByConversationId(Long.parseLong(chatConversationId));
for(ChatContent toUser :toUsers){
AppChatSocket chatSocket = clients.get(toUser.getUserId());
String toUserId = String.valueOf(toUser.getUserId());
AppChatSocket chatSocket = clients.get(toUserId);
if (chatSocket!=null) {
chatSocket.session.getAsyncRemote().sendText(message);
System.err.println(this.userId+"发送成功:"+userId);