Skip to content

Commit

Permalink
fix: tagGameEndResponse 반환하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
david-parkk committed Nov 1, 2024
1 parent 9128c14 commit 8832684
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import kutaverse.game.websocket.taggame.dto.request.TagGameEndRequest;
import kutaverse.game.websocket.taggame.dto.request.TagGameRequest;
import kutaverse.game.websocket.taggame.dto.request.TagGameResultStatus;
import kutaverse.game.websocket.taggame.dto.response.TagGameEndResponse;
import kutaverse.game.websocket.taggame.util.TagGameRoom;
import kutaverse.game.websocket.taggame.util.TagGameRoomManager;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -66,17 +67,19 @@ private void playerWin(TagGameRoom tagGameRoom) {

private void sendWinMessage(WebSocketSession webSocketSession) {
String winMessage = "승리하였습니다.";
TagGameEndResponse tagGameEndResponse = TagGameEndResponse.toDto(winMessage);
try {
String jsonMessage = objectMapper.writeValueAsString(winMessage);
String jsonMessage = objectMapper.writeValueAsString(tagGameEndResponse);
WebSocketMessage webSocketMessage = webSocketSession.textMessage(jsonMessage);
webSocketSession.send(Mono.just(webSocketMessage)).subscribe();
} catch (JsonProcessingException e) {}
}

private void sendLoseMessage(WebSocketSession webSocketSession) {
String winMessage = "패배하였습니다.";
TagGameEndResponse tagGameEndResponse = TagGameEndResponse.toDto(winMessage);
try {
String jsonMessage = objectMapper.writeValueAsString(winMessage);
String jsonMessage = objectMapper.writeValueAsString(tagGameEndResponse);
WebSocketMessage webSocketMessage = webSocketSession.textMessage(jsonMessage);
webSocketSession.send(Mono.just(webSocketMessage)).subscribe();
} catch (JsonProcessingException e) {}
Expand Down

0 comments on commit 8832684

Please sign in to comment.