Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,13 @@ public class CertifyWebSocketConfig implements WebSocketMessageBrokerConfigurer
private final StompAuthChannelInterceptor stompAuthChannelInterceptor;
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.setApplicationDestinationPrefixes("/pub"); // 클라이언트가 보내는 prefix
config.enableSimpleBroker("/sub"); // 서버가 보내는 prefix
config.enableSimpleBroker("/certification"); // 인증현황을 받아보기 위한 구독 주소
config.setApplicationDestinationPrefixes("/app"); // 클라이언트가 인증 요청을 보내는 주소
}

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws") // 클라이언트 WebSocket 연결 지점
.setAllowedOriginPatterns(
"*",
"https://assu.shop",
"http://localhost:63342",
"http://localhost:5173", // Vite 기본
"http://localhost:3000", // CRA/Next 기본
"http://127.0.0.1:*",
"http://192.168.*.*:*"); // 같은 LAN의 실제 기기 테스트용
// fallback for old browsers

// 클라이언트 WebSocket 연결 주소
registry.addEndpoint("/ws").setAllowedOriginPatterns("*"); // 클라이언트 WebSocket 연결 주소
// .setAllowedOriginPatterns("http://10.0.2.2:8080", "ws://10.0.2.2:8080");// CORS 허용
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
//package com.assu.server.domain.chat.config;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.messaging.simp.config.ChannelRegistration;
//import org.springframework.messaging.simp.config.MessageBrokerRegistry;
//import org.springframework.web.socket.config.annotation.*;
//
//@Configuration
//@EnableWebSocketMessageBroker
//public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
//
//
// @Override
// public void registerStompEndpoints(StompEndpointRegistry registry) {
// registry.addEndpoint("/ws") // 클라이언트 WebSocket 연결 지점
// .setAllowedOriginPatterns(
// "*",
// "https://assu.shop",
// "http://localhost:63342",
// "http://localhost:5173", // Vite 기본
// "http://localhost:3000", // CRA/Next 기본
// "http://127.0.0.1:*",
// "http://192.168.*.*:*"); // 같은 LAN의 실제 기기 테스트용
// // fallback for old browsers
//
// }
//
// @Override
// public void configureMessageBroker(MessageBrokerRegistry registry) {
// registry.setApplicationDestinationPrefixes("/pub"); // 클라이언트가 보내는 prefix
// registry.enableSimpleBroker("/sub"); // 서버가 보내는 prefix
// registry.enableSimpleBroker("/certification"); // 인증현황을 받아보기 위한 구독 주소
// registry.setApplicationDestinationPrefixes("/app"); // 클라이언트가 인증 요청을 보내는 주소
// }
//}
package com.assu.server.domain.chat.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.*;

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {


@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws") // 클라이언트 WebSocket 연결 지점
.setAllowedOriginPatterns(
"*",
"https://assu.shop",
"http://localhost:63342",
"http://localhost:5173", // Vite 기본
"http://localhost:3000", // CRA/Next 기본
"http://127.0.0.1:*",
"http://192.168.*.*:*"); // 같은 LAN의 실제 기기 테스트용
// fallback for old browsers

}

@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setApplicationDestinationPrefixes("/pub"); // 클라이언트가 보내는 prefix
registry.enableSimpleBroker("/sub"); // 서버가 보내는 prefix
registry.enableSimpleBroker("/certification"); // 인증현황을 받아보기 위한 구독 주소
registry.setApplicationDestinationPrefixes("/app"); // 클라이언트가 인증 요청을 보내는 주소
}
}