|
11 | 11 | import io.f1.backend.domain.game.dto.request.AnswerMessage; |
12 | 12 | import io.f1.backend.domain.game.dto.request.DefaultWebSocketRequest; |
13 | 13 | import io.f1.backend.domain.game.dto.request.GameStartRequest; |
| 14 | + |
14 | 15 | import lombok.RequiredArgsConstructor; |
| 16 | + |
15 | 17 | import org.springframework.messaging.Message; |
16 | 18 | import org.springframework.messaging.handler.annotation.DestinationVariable; |
17 | 19 | import org.springframework.messaging.handler.annotation.MessageMapping; |
@@ -75,26 +77,33 @@ public void gameStart(@DestinationVariable Long roomId, Message<GameStartRequest |
75 | 77 | } |
76 | 78 |
|
77 | 79 | @MessageMapping("room/chatInWaiting/{roomId}") |
78 | | - public void chatInWaiting(@DestinationVariable Long roomId, Message<DefaultWebSocketRequest<ChatMessage>> message) { |
| 80 | + public void chatInWaiting( |
| 81 | + @DestinationVariable Long roomId, |
| 82 | + Message<DefaultWebSocketRequest<ChatMessage>> message) { |
79 | 83 | String destination = "/sub/room/" + roomId; |
80 | 84 |
|
81 | | - messageSender.send(destination,MessageType.CHAT,message.getPayload()); |
| 85 | + messageSender.send(destination, MessageType.CHAT, message.getPayload()); |
82 | 86 | } |
83 | 87 |
|
84 | 88 | @MessageMapping("room/chatInPlaying/{roomId}") |
85 | | - public void chatInPlaying(@DestinationVariable Long roomId, Message<DefaultWebSocketRequest<AnswerMessage>> message) { |
| 89 | + public void chatInPlaying( |
| 90 | + @DestinationVariable Long roomId, |
| 91 | + Message<DefaultWebSocketRequest<AnswerMessage>> message) { |
86 | 92 |
|
87 | | - RoundResult roundResult = roomService.chatInPlaying(roomId, getSessionId(message), |
88 | | - message.getPayload().getMessage()); |
| 93 | + RoundResult roundResult = |
| 94 | + roomService.chatInPlaying( |
| 95 | + roomId, getSessionId(message), message.getPayload().getMessage()); |
89 | 96 |
|
90 | 97 | String destination = roundResult.getDestination(); |
91 | 98 |
|
92 | | - messageSender.send(destination,MessageType.CHAT, roundResult.getChat()); |
| 99 | + messageSender.send(destination, MessageType.CHAT, roundResult.getChat()); |
93 | 100 |
|
94 | | - if(!roundResult.hasOnlyChat()){ |
95 | | - messageSender.send(destination,MessageType.QUESTION_RESULT, roundResult.getQuestionResult()); |
96 | | - messageSender.send(destination,MessageType.RANK_UPDATE, roundResult.getRankUpdate()); |
97 | | - messageSender.send(destination,MessageType.SYSTEM_NOTICE, roundResult.getSystemNotice()); |
| 101 | + if (!roundResult.hasOnlyChat()) { |
| 102 | + messageSender.send( |
| 103 | + destination, MessageType.QUESTION_RESULT, roundResult.getQuestionResult()); |
| 104 | + messageSender.send(destination, MessageType.RANK_UPDATE, roundResult.getRankUpdate()); |
| 105 | + messageSender.send( |
| 106 | + destination, MessageType.SYSTEM_NOTICE, roundResult.getSystemNotice()); |
98 | 107 | } |
99 | 108 | } |
100 | 109 |
|
|
0 commit comments