Search code examples
spring-websocket

WebSocketMessageBrokerConfigurer


    public abstract class AbstractSessionWebSocketMessageBrokerConfigurer<S extends ExpiringSession> extends AbstractWebSocketMessageBrokerConfigurer {
    @Override
        public void configureWebSocketTransport(WebSocketTransportRegistration registration) {
            registration.addDecoratorFactory(wsConnectHandlerDecoratorFactory());
        }

    static class SessionStompEndpointRegistry implements StompEndpointRegistry {
            private final StompEndpointRegistry registry;
            private final HandshakeInterceptor interceptor;

            public SessionStompEndpointRegistry(StompEndpointRegistry registry,
                    HandshakeInterceptor interceptor) {
                this.registry = registry;
                this.interceptor = interceptor;
            }

            public StompWebSocketEndpointRegistration addEndpoint(String... paths) {
                StompWebSocketEndpointRegistration endpoints = registry.addEndpoint(paths);
                endpoints.addInterceptors(interceptor);
                return endpoints;
            }
        }

registration.addDecoratorFactory(wsConnectHandlerDecoratorFactory()); and endpoints.addInterceptors(interceptor); which doesn't exsit. How to write it is correct?


Solution

  • All those features are available in the latest Spring Framework versions. Try to use 4.1.3: http://spring.io/blog/2014/12/09/spring-framework-4-1-3-released