Class StompSubProtocolErrorHandler
java.lang.Object
org.springframework.web.socket.messaging.StompSubProtocolErrorHandler
- All Implemented Interfaces:
SubProtocolErrorHandler<byte[]>
A
SubProtocolErrorHandler for use with STOMP.- Since:
- 4.2
- Author:
- Rossen Stoyanchev
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhandleClientMessageProcessingError(@Nullable Message<byte[]> clientMessage, Throwable ex) Handle errors thrown while processing client messages providing an opportunity to prepare the error message or to prevent one from being sent.handleErrorMessageToClient(Message<byte[]> errorMessage) Handle errors sent from the server side to clients, for example, errors from the"broke relay"because connectivity failed or the external broker sent an error message, etc.protected Message<byte[]>handleInternal(StompHeaderAccessor errorHeaderAccessor, byte[] errorPayload, @Nullable Throwable cause, @Nullable StompHeaderAccessor clientHeaderAccessor)
-
Constructor Details
-
StompSubProtocolErrorHandler
public StompSubProtocolErrorHandler()
-
-
Method Details
-
handleClientMessageProcessingError
public @Nullable Message<byte[]> handleClientMessageProcessingError(@Nullable Message<byte[]> clientMessage, Throwable ex) Description copied from interface:SubProtocolErrorHandlerHandle errors thrown while processing client messages providing an opportunity to prepare the error message or to prevent one from being sent.Note that the STOMP protocol requires a server to close the connection after sending an ERROR frame. To prevent an ERROR frame from being sent, a handler could return
nulland send a notification message through the broker instead, for example, via a user destination.- Specified by:
handleClientMessageProcessingErrorin interfaceSubProtocolErrorHandler<byte[]>- Parameters:
clientMessage- the client message related to the error, possiblynullif error occurred while parsing a WebSocket messageex- the cause for the error, nevernull- Returns:
- the error message to send to the client, or
nullin which case no message will be sent.
-
handleErrorMessageToClient
Description copied from interface:SubProtocolErrorHandlerHandle errors sent from the server side to clients, for example, errors from the"broke relay"because connectivity failed or the external broker sent an error message, etc.- Specified by:
handleErrorMessageToClientin interfaceSubProtocolErrorHandler<byte[]>- Parameters:
errorMessage- the error message, nevernull- Returns:
- the error message to send to the client, or
nullin which case no message will be sent.
-
handleInternal
protected Message<byte[]> handleInternal(StompHeaderAccessor errorHeaderAccessor, byte[] errorPayload, @Nullable Throwable cause, @Nullable StompHeaderAccessor clientHeaderAccessor)
-