SubProtocolHandler for STOMP that supports versions 1.0, 1.1, and 1.2
of the STOMP specification.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public static interface | StompSubProtocolHandler.
Contract for access to session counters. |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | CONNECTED_USER_HEADER
The name of the header set on the CONNECTED frame indicating the name of the user authenticated on the WebSocket session. |
| private final Map | |
| private static final byte[] | |
| private StompSubProtocolErrorHandler | |
| private ApplicationEventPublisher | |
| private MessageHeaderInitializer | |
| private Boolean | |
| private static final Log | |
| private int | |
| public static final int | MINIMUM_WEBSOCKET_MESSAGE_SIZE
This handler supports assembling large STOMP messages split into multiple WebSocket messages and STOMP clients (like stomp.js) indeed split large STOMP messages at 16K boundaries. |
| private Map | |
| private final StompSubProtocolHandler. | |
| private final Map | |
| private StompDecoder | |
| private StompEncoder | |
| private static final String[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterSessionEnded(WebSocketSession
the client session session, CloseStatus the reason why the session was closed closeStatus, MessageChannel a channel outputChannel)Implements org. Invoked after a |
| public void | afterSessionStarted(WebSocketSession
the client session session, MessageChannel a channel outputChannel)Implements org. Invoked after a |
| private StompHeaderAccessor | afterStompSessionConnected(Message<?> message, StompHeaderAccessor accessor, WebSocketSession session)
|
| private StompHeaderAccessor | convertConnectAcktoStompConnected(StompHeaderAccessor connectAckHeaders)
The simple broker produces |
| private Message | |
| private boolean | |
| private String | |
| public StompSubProtocolErrorHandler | |
| public MessageHeaderInitializer | |
| public int | |
| public StompSubProtocolHandler. | |
| public String | |
| private StompHeaderAccessor | |
| public List | getSupportedProtocols()
Implements org. Return the list of sub-protocols supported by this handler (never |
| private Principal | |
| private void | |
| public void | handleMessageFromClient(WebSocketSession
the client session session, WebSocketMessage<?> the client message webSocketMessage, MessageChannel an output channel to send messages to targetChannel)Implements org. Handle incoming WebSocket messages from clients. |
| public void | handleMessageToClient(WebSocketSession
the client session session, Message<?> the client message message)Implements org. Handle STOMP messages going back out to WebSocket clients. |
| public boolean | isPreserveReceiveOrder()
Whether the handler is configured to handle inbound messages in the order in which they were received. |
| private void | |
| public String | resolveSessionId(Message<?>
the message to resolve the session id from message)Implements org. Resolve the session id from the given message or return |
| private void | sendErrorMessage(WebSocketSession session, Throwable error)
Invoked when no
|
| private void | |
| public void | setApplicationEventPublisher(ApplicationEventPublisher
event publisher to be used by this object applicationEventPublisher)Implements org. Set the ApplicationEventPublisher that this object runs in. Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. |
| public void | |
| public void | |
| public void | setErrorHandler(StompSubProtocolErrorHandler
the error handler errorHandler)Configure a handler for error messages sent to clients which allows customizing the error messages or preventing them from being sent. |
| public void | setHeaderInitializer(MessageHeaderInitializer headerInitializer)
Configure a |
| public void | setMessageSizeLimit(int messageSizeLimit)
Configure the maximum size allowed for an incoming STOMP message. |
| public void | setPreserveReceiveOrder(boolean
whether to publish in order preserveReceiveOrder)Whether client messages must be handled in the order received. |
| protected StompHeaderAccessor | |
| public String |
| CONNECTED_USER_HEADER | back to summary |
|---|---|
| public static final String CONNECTED_USER_HEADER The name of the header set on the CONNECTED frame indicating the name of the user authenticated on the WebSocket session. | |
| decoders | back to summary |
|---|---|
| private final Map<String, BufferingStompDecoder> decoders | |
| EMPTY_PAYLOAD | back to summary |
|---|---|
| private static final byte[] EMPTY_PAYLOAD | |
| errorHandler | back to summary |
|---|---|
| private StompSubProtocolErrorHandler errorHandler
| |
| eventPublisher | back to summary |
|---|---|
| private ApplicationEventPublisher eventPublisher
| |
| headerInitializer | back to summary |
|---|---|
| private MessageHeaderInitializer headerInitializer
| |
| immutableMessageInterceptorPresent | back to summary |
|---|---|
| private Boolean immutableMessageInterceptorPresent
| |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| messageSizeLimit | back to summary |
|---|---|
| private int messageSizeLimit | |
| MINIMUM_WEBSOCKET_MESSAGE_SIZE | back to summary |
|---|---|
| public static final int MINIMUM_WEBSOCKET_MESSAGE_SIZE This handler supports assembling large STOMP messages split into multiple WebSocket messages and STOMP clients (like stomp.js) indeed split large STOMP messages at 16K boundaries. Therefore the WebSocket server input message buffer size must allow 16K at least plus a little extra for SockJS framing. | |
| orderedHandlingMessageChannels | back to summary |
|---|---|
| private Map<String, MessageChannel> orderedHandlingMessageChannels
| |
| stats | back to summary |
|---|---|
| private final StompSubProtocolHandler. | |
| stompAuthentications | back to summary |
|---|---|
| private final Map<String, Principal> stompAuthentications | |
| stompDecoder | back to summary |
|---|---|
| private StompDecoder stompDecoder | |
| stompEncoder | back to summary |
|---|---|
| private StompEncoder stompEncoder | |
| SUPPORTED_VERSIONS | back to summary |
|---|---|
| private static final String[] SUPPORTED_VERSIONS | |
| StompSubProtocolHandler | back to summary |
|---|---|
| public StompSubProtocolHandler() | |
| afterSessionEnded | back to summary |
|---|---|
| public void afterSessionEnded(WebSocketSession session, CloseStatus closeStatus, MessageChannel outputChannel) Implements org. Doc from org. Invoked after a
| |
| afterSessionStarted | back to summary |
|---|---|
| public void afterSessionStarted(WebSocketSession session, MessageChannel outputChannel) Implements org. Doc from org. Invoked after a
| |
| afterStompSessionConnected | back to summary |
|---|---|
| private StompHeaderAccessor afterStompSessionConnected(Message<?> message, StompHeaderAccessor accessor, WebSocketSession session) | |
| convertConnectAcktoStompConnected | back to summary |
|---|---|
| private StompHeaderAccessor convertConnectAcktoStompConnected(StompHeaderAccessor connectAckHeaders) The simple broker produces | |
| createDisconnectMessage | back to summary |
|---|---|
| private Message | |
| detectImmutableMessageInterceptor | back to summary |
|---|---|
| private boolean detectImmutableMessageInterceptor(MessageChannel channel) | |
| getDisconnectReceipt | back to summary |
|---|---|
private String getDisconnectReceipt(SimpMessageHeaderAccessor simpHeaders)
| |
| getErrorHandler | back to summary |
|---|---|
| public StompSubProtocolErrorHandler getErrorHandler() Return the configured error handler.
| |
| getHeaderInitializer | back to summary |
|---|---|
| public MessageHeaderInitializer getHeaderInitializer() Return the configured header initializer.
| |
| getMessageSizeLimit | back to summary |
|---|---|
| public int getMessageSizeLimit() Get the configured message buffer size limit in bytes.
| |
| getStats | back to summary |
|---|---|
| public StompSubProtocolHandler. Return a structured object with internal state and counters.
| |
| getStatsInfo | back to summary |
|---|---|
| public String getStatsInfo() Return a String describing internal state and counters.
Effectively | |
| getStompHeaderAccessor | back to summary |
|---|---|
| private StompHeaderAccessor getStompHeaderAccessor(Message<?> message) | |
| getSupportedProtocols | back to summary |
|---|---|
| public List Implements org. Doc from org. Return the list of sub-protocols supported by this handler (never
| |
| getUser | back to summary |
|---|---|
private Principal getUser(WebSocketSession session)
| |
| handleError | back to summary |
|---|---|
| private void handleError(WebSocketSession session, Throwable ex, Message<byte[]> clientMessage) | |
| handleMessageFromClient | back to summary |
|---|---|
| public void handleMessageFromClient(WebSocketSession session, WebSocketMessage<?> webSocketMessage, MessageChannel targetChannel) Implements org. Handle incoming WebSocket messages from clients.
| |
| handleMessageToClient | back to summary |
|---|---|
| public void handleMessageToClient(WebSocketSession session, Message<?> message) Implements org. Handle STOMP messages going back out to WebSocket clients.
| |
| isPreserveReceiveOrder | back to summary |
|---|---|
| public boolean isPreserveReceiveOrder() Whether the handler is configured to handle inbound messages in the order in which they were received.
| |
| publishEvent | back to summary |
|---|---|
| private void publishEvent(ApplicationEventPublisher publisher, ApplicationEvent event) | |
| resolveSessionId | back to summary |
|---|---|
| public String resolveSessionId(Message<?> message) Implements org. Doc from org. Resolve the session id from the given message or return | |
| sendErrorMessage | back to summary |
|---|---|
| private void sendErrorMessage(WebSocketSession session, Throwable error) Invoked when no
| |
| sendToClient | back to summary |
|---|---|
| private void sendToClient(WebSocketSession session, StompHeaderAccessor stompAccessor, byte[] payload) | |
| setApplicationEventPublisher | back to summary |
|---|---|
| public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) Implements org. Doc from org. Set the ApplicationEventPublisher that this object runs in. Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked before ApplicationContextAware's setApplicationContext.
| |
| setDecoder | back to summary |
|---|---|
| public void setDecoder(StompDecoder decoder) Configure a
| |
| setEncoder | back to summary |
|---|---|
| public void setEncoder(StompEncoder encoder) Configure a
| |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(StompSubProtocolErrorHandler errorHandler) Configure a handler for error messages sent to clients which allows customizing the error messages or preventing them from being sent. By default this isn't configured in which case an ERROR frame is sent with a message header reflecting the error.
| |
| setHeaderInitializer | back to summary |
|---|---|
| public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) Configure a By default this property is not set. | |
| setMessageSizeLimit | back to summary |
|---|---|
| public void setMessageSizeLimit(int messageSizeLimit) Configure the maximum size allowed for an incoming STOMP message. Since a STOMP message can be received in multiple WebSocket messages, buffering may be required and therefore it is necessary to know the maximum allowed message size. By default this property is set to 64K.
| |
| setPreserveReceiveOrder | back to summary |
|---|---|
| public void setPreserveReceiveOrder(boolean preserveReceiveOrder) Whether client messages must be handled in the order received. By default messages sent to the When this flag is set to
| |
| toMutableAccessor | back to summary |
|---|---|
| protected StompHeaderAccessor toMutableAccessor(StompHeaderAccessor headerAccessor, Message<?> message) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicInteger | |
| private final AtomicInteger | |
| private final AtomicInteger |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | getTotalConnect()
Implements org. The number of CONNECT frames processed. |
| public int | getTotalConnected()
Implements org. The number of CONNECTED frames processed. |
| public int | getTotalDisconnect()
Implements org. The number of DISCONNECT frames processed. |
| public void | |
| public void | |
| public void | |
| public String |
| connect | back to summary |
|---|---|
| private final AtomicInteger connect | |
| connected | back to summary |
|---|---|
| private final AtomicInteger connected | |
| disconnect | back to summary |
|---|---|
| private final AtomicInteger disconnect | |
| DefaultStats | back to summary |
|---|---|
| private DefaultStats() | |
| getTotalConnect | back to summary |
|---|---|
| public int getTotalConnect() Implements org. Doc from org. The number of CONNECT frames processed.
| |
| getTotalConnected | back to summary |
|---|---|
| public int getTotalConnected() Implements org. Doc from org. The number of CONNECTED frames processed.
| |
| getTotalDisconnect | back to summary |
|---|---|
| public int getTotalDisconnect() Implements org. Doc from org. The number of DISCONNECT frames processed.
| |
| incrementConnectCount | back to summary |
|---|---|
| public void incrementConnectCount() | |
| incrementConnectedCount | back to summary |
|---|---|
| public void incrementConnectedCount() | |
| incrementDisconnectCount | back to summary |
|---|---|
| public void incrementDisconnectCount() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | |
| public int |
| getTotalConnect | back to summary |
|---|---|
| public int getTotalConnect() The number of CONNECT frames processed. | |
| getTotalConnected | back to summary |
|---|---|
| public int getTotalConnected() The number of CONNECTED frames processed. | |
| getTotalDisconnect | back to summary |
|---|---|
| public int getTotalDisconnect() The number of DISCONNECT frames processed. | |