goldenChat base source add
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.goldenchart.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
|
||||
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
|
||||
|
||||
/**
|
||||
* STOMP WebSocket 브로커 설정.
|
||||
*
|
||||
* 클라이언트 연결 엔드포인트:
|
||||
* ws(s)://host/ws/trading (SockJS fallback 지원)
|
||||
*
|
||||
* 구독 채널 (명세서 5.2):
|
||||
* /sub/charts/{market}/{type} — 실시간 캔들 배포
|
||||
*
|
||||
* 발행 채널:
|
||||
* /pub/... — 클라이언트 → 서버 (향후 확장용)
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSocketMessageBroker
|
||||
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
||||
|
||||
@Override
|
||||
public void configureMessageBroker(MessageBrokerRegistry registry) {
|
||||
// 인메모리 심플 브로커: /sub 접두사 구독 채널에 메시지 라우팅
|
||||
registry.enableSimpleBroker("/sub");
|
||||
// 클라이언트 발행 경로 접두사 (서버측 @MessageMapping 핸들러로 라우팅)
|
||||
registry.setApplicationDestinationPrefixes("/pub");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
||||
registry.addEndpoint("/ws/trading")
|
||||
.setAllowedOriginPatterns("*")
|
||||
.withSockJS(); // SockJS fallback (브라우저 환경 대비)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user