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
Session
is kept alive on incoming web socket messages. - Ensures that Web Socket Sessions are destroyed when a
Session
is 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configureClientInboundChannel
(org.springframework.messaging.simp.config.ChannelRegistration registration) 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 aSessionRepositoryMessageInterceptor
automatically added as an interceptor.void
configureWebSocketTransport
(org.springframework.web.socket.config.annotation.WebSocketTransportRegistration registration) final void
registerStompEndpoints
(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
addArgumentResolvers, addReturnValueHandlers, configureClientOutboundChannel, configureMessageBroker, configureMessageConverters
-
Constructor Details
-
AbstractSessionWebSocketMessageBrokerConfigurer
public AbstractSessionWebSocketMessageBrokerConfigurer()
-
-
Method Details
-
configureClientInboundChannel
public void configureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration registration) - Specified by:
configureClientInboundChannel
in interfaceorg.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
-
registerStompEndpoints
public final void registerStompEndpoints(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry) - Specified by:
registerStompEndpoints
in 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 aSessionRepositoryMessageInterceptor
automatically added as an interceptor.- Parameters:
registry
- theStompEndpointRegistry
which automatically has aSessionRepositoryMessageInterceptor
added to it.
-
configureWebSocketTransport
public void configureWebSocketTransport(org.springframework.web.socket.config.annotation.WebSocketTransportRegistration registration) - Specified by:
configureWebSocketTransport
in interfaceorg.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
-
webSocketRegistryListener
-
wsConnectHandlerDecoratorFactory
-
sessionRepositoryInterceptor
-