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); - } -}