package kr.wisestone.owl.config; import kr.wisestone.owl.config.websocket.WebSocketHandshakeHandler; 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; import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor; @Configuration @EnableWebSocketMessageBroker public class WebSocketStompConfiguration implements WebSocketMessageBrokerConfigurer { @Override public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) { stompEndpointRegistry.addEndpoint("/owl-socket") .setAllowedOrigins("*") .addInterceptors(new HttpSessionHandshakeInterceptor()) .setHandshakeHandler(new WebSocketHandshakeHandler()) .withSockJS(); } @Override public void configureMessageBroker(MessageBrokerRegistry registry) { registry.enableSimpleBroker("/session", "/notification", "/permission"); registry.setApplicationDestinationPrefixes("/app"); } }