Skip to content

Commit

Permalink
Core server: PR#71
Browse files Browse the repository at this point in the history
  • Loading branch information
Berygna committed Jun 22, 2024
1 parent 0aa5453 commit 1fcac23
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ public class WebSocketSecurityConfig extends AbstractSecurityWebSocketMessageBro
protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) {
messages
.nullDestMatcher().permitAll()
.simpSubscribeDestMatchers("/user/queue/game/session",
"/user/queue/game/sessions",
"/user/queue/game/join",
"/user/queue/game/start",
"/user/queue/game/result",
"/user/queue/game/over").authenticated()
.simpSubscribeDestMatchers("/**").authenticated()
.simpSubscribeDestMatchers("/topic/room/*").permitAll()
.simpDestMatchers("/app/**").authenticated()
.anyMessage().denyAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected GameSession(String hostId, String title, String problemLevel, Integer
this.hostId = hostId;
this.maxPlayer = 2;
this.players = new CopyOnWriteArraySet<>();
players.add(hostId);
this.players.add(hostId);
this.readyPlayers = new CopyOnWriteArraySet<>();
this.problemLevel = "1";
this.timerTime = 1200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,11 @@ public void handleWebSocketDisconnectListener(SessionDisconnectEvent event) {

String playerId = event.getUser().getName();
GameSession session = getSession(playerId);
session.removePlayer(playerId);
if(playerId.equals(session.getHostId())) {
removeSession(session);
//TODO 참가중인 모든 플레이어에게 방 삭제 메시지 발행
} else {
session.removePlayer(playerId);
}

// 퇴장 메시지 발행
Expand Down

0 comments on commit 1fcac23

Please sign in to comment.