Class AbstractSubProtocolEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.web.socket.messaging.AbstractSubProtocolEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SessionConnectedEvent
,SessionConnectEvent
,SessionDisconnectEvent
,SessionSubscribeEvent
,SessionUnsubscribeEvent
A base class for events for a message received from a WebSocket client and
parsed into a higher-level sub-protocol (e.g. STOMP).
- Since:
- 4.1
- Author:
- Rossen Stoyanchev
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractSubProtocolEvent
(Object source, Message<byte[]> message) Create a new AbstractSubProtocolEvent.protected
AbstractSubProtocolEvent
(Object source, Message<byte[]> message, Principal user) Create a new AbstractSubProtocolEvent. -
Method Summary
Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
getSource
-
Constructor Details
-
AbstractSubProtocolEvent
Create a new AbstractSubProtocolEvent.- Parameters:
source
- the component that published the event (nevernull
)message
- the incoming message (nevernull
)
-
AbstractSubProtocolEvent
protected AbstractSubProtocolEvent(Object source, Message<byte[]> message, @Nullable Principal user) Create a new AbstractSubProtocolEvent.- Parameters:
source
- the component that published the event (nevernull
)message
- the incoming message (nevernull
)
-
-
Method Details
-
getMessage
Return the Message associated with the event. Here is an example of obtaining information about the session id or any headers in the message:StompHeaderAccessor headers = StompHeaderAccessor.wrap(message); headers.getSessionId(); headers.getSessionAttributes(); headers.getPrincipal();
-
getUser
Return the user for the session associated with the event. -
toString
- Overrides:
toString
in classEventObject
-