-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
106 additions
and
15 deletions.
There are no files selected for viewing
11 changes: 7 additions & 4 deletions
11
src/main/java/getaguitar/site/demo/Controller/ChatController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
package getaguitar.site.demo.Controller; | ||
|
||
import getaguitar.site.demo.Dto.ResChatMessageDto; | ||
import getaguitar.site.demo.Dto.ChatMessage.ReqChatMessageDto; | ||
import getaguitar.site.demo.Dto.ChatMessage.ResChatMessageDto; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.messaging.handler.annotation.MessageMapping; | ||
import org.springframework.messaging.handler.annotation.Payload; | ||
import org.springframework.messaging.handler.annotation.SendTo; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@MessageMapping("/chat") | ||
@RequiredArgsConstructor | ||
@MessageMapping("/chat") | ||
public class ChatController { | ||
|
||
@MessageMapping("/message") | ||
@SendTo("/topic/chat/message") | ||
public ResChatMessageDto sendMessage(ResChatMessageDto message) { | ||
return message; | ||
public ResChatMessageDto sendMessage(@Payload ReqChatMessageDto message) { | ||
ResChatMessageDto resChatMessageDto = new ResChatMessageDto(message.getText(), message.getUsername()); | ||
return resChatMessageDto; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/getaguitar/site/demo/Dto/ChatMessage/ReqChatMessageDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package getaguitar.site.demo.Dto.ChatMessage; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
public class ReqChatMessageDto { | ||
private String room; | ||
private String text; | ||
private String username; | ||
} |
2 changes: 1 addition & 1 deletion
2
...itar/site/demo/Dto/ResChatMessageDto.java → ...mo/Dto/ChatMessage/ResChatMessageDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...taguitar/site/demo/Dto/ReqNewUserDto.java → .../site/demo/Dto/NewUser/ReqNewUserDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...taguitar/site/demo/Dto/ResNewUserDto.java → .../site/demo/Dto/NewUser/ResNewUserDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package getaguitar.site.demo.Dto; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
public class Player { | ||
private String id; | ||
private int x; | ||
private int y; | ||
private String direction; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/getaguitar/site/demo/Dto/ReqStopUserDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package getaguitar.site.demo.Dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
public class ReqStopUserDto { | ||
private String username; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/getaguitar/site/demo/Dto/ResStopUserDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package getaguitar.site.demo.Dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
public class ResStopUserDto { | ||
private String id; | ||
private int x; | ||
private int y; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
package getaguitar.site.demo.Service; | ||
|
||
import getaguitar.site.demo.Dto.ReqNewUserDto; | ||
import getaguitar.site.demo.Dto.ResMoveUserDto; | ||
import getaguitar.site.demo.Dto.ResNewUserDto; | ||
import getaguitar.site.demo.Dto.ReqStopUserDto; | ||
import getaguitar.site.demo.Dto.ResStopUserDto; | ||
import getaguitar.site.demo.Dto.NewUser.ReqNewUserDto; | ||
import getaguitar.site.demo.Dto.NewUser.ResNewUserDto; | ||
|
||
public interface MapService { | ||
ResNewUserDto createUser(ReqNewUserDto newUser); | ||
ResStopUserDto stopUser(ReqStopUserDto stopUser); | ||
ResMoveUserDto moveUser(String direction); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters