Skip to content

Commit 8e76715

Browse files
committed
[BE] refactor: room users 조회를 웹 소켓 stomp connected인 경우로 변경 (#98)
Signed-off-by: EunJiJung <bianbbc87@gmail.com>
1 parent 18ada79 commit 8e76715

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/backend/signaling-server/src/main/java/com/asyncgate/signaling_server/security/filter/FilterChannelInterceptor.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class FilterChannelInterceptor implements ChannelInterceptor {
1919

2020
private static final Logger log = LoggerFactory.getLogger(FilterChannelInterceptor.class);
2121
private static final String AUTHORIZATION_HEADER = "Authorization";
22+
23+
private static final String ROOM_HEADER = "room-id";
2224
private static final String BEARER_PREFIX = "Bearer ";
2325
private final JsonWebTokenUtil jsonWebTokenUtil;
2426

@@ -51,7 +53,15 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
5153
if(headerAccessor.getSessionAttributes().get("userId") == null) {
5254
throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "userId is missing");
5355
}
54-
log.info("✅ [STOMP] CONNECT 요청 처리 완료");
56+
57+
// ✅ roomId 가져오기
58+
String roomId = headerAccessor.getFirstNativeHeader(ROOM_HEADER);
59+
if (roomId == null || roomId.isEmpty()) {
60+
log.error("🚨 [STOMP] Room ID is missing!");
61+
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Room ID is missing");
62+
}
63+
64+
log.info("✅ [STOMP] CONNECT 요청 처리 완료 - Room ID: {}", roomId);
5565
}
5666
return message;
5767
}

0 commit comments

Comments
 (0)