Class AbstractSessionWebSocketMessageBrokerConfigurer<S extends Session>
java.lang.Object
org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer<S>
- Type Parameters:
S- the type of Session
- All Implemented Interfaces:
org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
public abstract class AbstractSessionWebSocketMessageBrokerConfigurer<S extends Session>
extends Object
implements org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
Eases configuration of Web Socket and Spring Session integration.
The configuration:
- Ensures the
Sessionis kept alive on incoming web socket messages. - Ensures that Web Socket Sessions are destroyed when a
Sessionis terminated
Example usage
@Configuration
@EnableScheduling
@EnableWebSocketMessageBroker
public class WebSocketConfig<S extends Session> extends AbstractSessionWebSocketMessageBrokerConfigurer<S> {
@Override
protected void configureStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/messages")
.withSockJS();
}
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/queue/", "/topic/");
registry.setApplicationDestinationPrefixes("/app");
}
}
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration registration) protected abstract voidconfigureStompEndpoints(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry) Register STOMP endpoints mapping each to a specific URL and (optionally) enabling and configuring SockJS fallback options with aSessionRepositoryMessageInterceptorautomatically added as an interceptor.voidconfigureWebSocketTransport(org.springframework.web.socket.config.annotation.WebSocketTransportRegistration registration) final voidregisterStompEndpoints(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry) static WebSocketRegistryListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
addArgumentResolvers, addReturnValueHandlers, configureClientOutboundChannel, configureMessageBroker, configureMessageConverters, getPhase
-
Constructor Details
-
AbstractSessionWebSocketMessageBrokerConfigurer
public AbstractSessionWebSocketMessageBrokerConfigurer()
-
-
Method Details
-
configureClientInboundChannel
public void configureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration registration) - Specified by:
configureClientInboundChannelin interfaceorg.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
-
registerStompEndpoints
public final void registerStompEndpoints(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry) - Specified by:
registerStompEndpointsin interfaceorg.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
-
configureStompEndpoints
protected abstract void configureStompEndpoints(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry) Register STOMP endpoints mapping each to a specific URL and (optionally) enabling and configuring SockJS fallback options with aSessionRepositoryMessageInterceptorautomatically added as an interceptor.- Parameters:
registry- theStompEndpointRegistrywhich automatically has aSessionRepositoryMessageInterceptoradded to it.
-
configureWebSocketTransport
public void configureWebSocketTransport(org.springframework.web.socket.config.annotation.WebSocketTransportRegistration registration) - Specified by:
configureWebSocketTransportin interfaceorg.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
-
webSocketRegistryListener
-
wsConnectHandlerDecoratorFactory
-
sessionRepositoryInterceptor
-