From 0466baae700c00b7c989bb70e05a2da60c00ad1e Mon Sep 17 00:00:00 2001 From: yhpark95 <98851575+yhpark95@users.noreply.github.com> Date: Thu, 21 Sep 2023 12:16:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20WebSocket=20handler=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20#81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/websocket/WebSocketHandler.java | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 be/src/main/java/kr/codesquad/core/websocket/WebSocketHandler.java diff --git a/be/src/main/java/kr/codesquad/core/websocket/WebSocketHandler.java b/be/src/main/java/kr/codesquad/core/websocket/WebSocketHandler.java deleted file mode 100644 index 9af5945fc..000000000 --- a/be/src/main/java/kr/codesquad/core/websocket/WebSocketHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package kr.codesquad.core.websocket; - -import org.springframework.stereotype.Component; -import org.springframework.web.socket.TextMessage; -import org.springframework.web.socket.WebSocketSession; -import org.springframework.web.socket.handler.TextWebSocketHandler; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import kr.codesquad.chat.dto.request.SendMessageRequest; -import kr.codesquad.chat.service.ChatService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Component -@RequiredArgsConstructor -public class WebSocketHandler extends TextWebSocketHandler { - - private final ChatService chatService; - private final ObjectMapper objectMapper; - - @Override - protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { - String payload = message.getPayload(); - log.info("payload:{}", payload); - - SendMessageRequest msg = objectMapper.readValue(payload, SendMessageRequest.class); - chatService.sendMessage(msg.getChatRoomId(), session, msg); - } -}