File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/main/kotlin/com/back/koreaTravelGuide/common/config Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ package com.back.koreaTravelGuide.common.config
2+
3+ import org.springframework.context.annotation.Configuration
4+ import org.springframework.messaging.simp.config.MessageBrokerRegistry
5+ import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker
6+ import org.springframework.web.socket.config.annotation.StompEndpointRegistry
7+ import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
8+
9+ @Configuration
10+ @EnableWebSocketMessageBroker
11+ class WebSocketConfig : WebSocketMessageBrokerConfigurer {
12+ override fun registerStompEndpoints (registry : StompEndpointRegistry ) {
13+ registry.addEndpoint(" /ws/chat" )
14+ .addInterceptors(JwtHandsshakeInterceptor ) // JWT 체크
15+ .setAllowedOrigins(" *" )
16+ .withSockJS() // 개발 중 호환성
17+ }
18+
19+ override fun configureMessageBroker (registry : MessageBrokerRegistry ) {
20+ registry.enableSimpleBroker(" /sub" ) // 구독 경로
21+ registry.setApplicationDestinationPrefixes(" /app" ) // 클라이언트에서 보낼 때
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments