Skip to content

Commit

Permalink
Merge pull request #121 from wooyeon0626/feature/chatting
Browse files Browse the repository at this point in the history
[FEAT] stomp session count log 추가
  • Loading branch information
tenta3802 authored Feb 29, 2024
2 parents 7447ca0 + c00991d commit 0774d58
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void enter(StompDto stompDto, @Header("Authorization") String token) {
} else if ("1".equals(sessionStore.get(roomId.toString()))) {
sessionStore.put(roomId.toString(), "2");
}
log.info(sessionStore.get(roomId.toString()));
log.info("session count = " + sessionStore.get(roomId.toString()));
}

if (stompDto.getType().equals(StompDto.MessageType.TALK.toString())) {
Expand All @@ -72,22 +72,23 @@ public void enter(StompDto stompDto, @Header("Authorization") String token) {
simpMessageSendingOperations.convertAndSend("/queue/chat/room/" + stompDto.getRoomId(), stompRes);

chatService.saveChat(stompDto, sessionStore, loginEmail);
log.info(sessionStore.get(roomId.toString()));
log.info("채팅 전송 완료");
}

if (stompDto.getType().equals(StompDto.MessageType.QUIT.toString())) {
String sessionCount = sessionStore.get(roomId.toString());
int count = Integer.parseInt(sessionCount);
count -= 1;
sessionStore.put(roomId.toString(), String.valueOf(count));
log.info(sessionStore.get(roomId.toString()));
log.info("session count = " + sessionStore.get(roomId.toString()));
}

if (stompDto.getType().equals(StompDto.MessageType.TALK.toString()) &&
"1".equals(sessionStore.get(roomId.toString()))) {
log.info("session count = " + sessionStore.get(roomId.toString()));
log.info("FCM 메시지 전송함");
try {
fcmService.sendMessageTo(FcmDto.buildRequest(loginEmail, stompDto, userRepository, matchRepository));
log.info("FCM 메시지 전송함");
} catch (IOException e) {
throw new WooyeonException(ExceptionCode.FCM_SEND_FAIL_ERROR);
}
Expand Down

0 comments on commit 0774d58

Please sign in to comment.