Table of contents
Spring Session integration
wamp2spring-session-servlet supplies hooks connecting servlet WebSocket activity with Spring Session. It is separate from WAMP session management and the wamp.session.* MetaAPIs.
Setup
Add the module using the same version as your other WAMP dependencies, configure a Spring Session SessionRepository, and enable both integrations:
import org.springframework.context.annotation.Configuration;
import ch.rasc.wamp2spring.servlet.EnableServletWamp;
import ch.rasc.wamp2spring.session.servlet.EnableWampServletSession;
@Configuration
@EnableServletWamp
@EnableWampServletSession
public class SessionWampConfiguration {
}
The annotation imports SessionWampServletConfigurer; it does not create a repository or select a session backend.
What the module installs
- A handshake interceptor captures an existing HTTP session ID as the WebSocket attribute
SPRING.SESSION.ID. It does not create an HTTP session. WebSocketConnectHandlerDecoratorFactoryandWebSocketRegistryListenerconnect WebSocket lifecycle handling with Spring Session.- An inbound
SessionRepositoryMessageInterceptorreadsSPRING.SESSION.IDfrom message headers, updates the repository session's last-accessed time, and saves it when present.
The interceptor excludes HELLO, WELCOME, CHALLENGE, AUTHENTICATE, ABORT, GOODBYE, and ERROR from activity refresh. Outbound messages do not refresh the session through this interceptor.
Current source limitation
In the documented revision, WampSessionSupport.populateHeaders copies WAMP metadata but does not copy the SPRING.SESSION.ID WebSocket attribute into inbound message headers. The session interceptor therefore cannot refresh the backing session on the stock transport path unless application integration supplies that header. Enabling the annotation alone should not be treated as a guarantee that WAMP traffic extends the HTTP session lifetime.
This module decorates servlet WebSockets. There is no equivalent adapter for reactive WebSockets or for the long-poll controller. It does not persist or distribute WAMP registrations, subscriptions, retained events, or pending calls; those remain local router state.
Source: session integration, header population.
Table of Contents
- Introduction
- Quickstart
- Maven
- Modules
- Features
- Configuration
- RPC
- Publish/Subscribe
- Meta APIs
- Security
- Authentication
- Transports
- Spring Session
- Events