Top Description Methods
org.springframework.web.socket.messaging

public Interface SubProtocolErrorHandler<P>

Known Direct Implementers
org.springframework.web.socket.messaging.StompSubProtocolErrorHandler
Type Parameters
<P>
the message payload type
Imports
org.springframework.lang.Nullable, org.springframework.messaging.Message

A contract for handling sub-protocol errors sent to clients.
Author
Rossen Stoyanchev
Since
4.2

Method Summary

Modifier and TypeMethod and Description
public Message<P>

Returns:

the error message to send to the client, or null in which case no message will be sent.
handleClientMessageProcessingError
(Message<P>
the client message related to the error, possibly null if error occurred while parsing a WebSocket message
clientMessage
,
Throwable
the cause for the error, never null
ex
)

Handle errors thrown while processing client messages providing an opportunity to prepare the error message or to prevent one from being sent.

public Message<P>

Returns:

the error message to send to the client, or null in which case no message will be sent.
handleErrorMessageToClient
(Message<P>
the error message, never null
errorMessage
)

Handle errors sent from the server side to clients, e.g. errors from the "broke relay" because connectivity failed or the external broker sent an error message, etc.

Method Detail

handleClientMessageProcessingErrorback to summary
public Message<P> handleClientMessageProcessingError(Message<P> 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.

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 null and send a notification message through the broker instead, e.g. via a user destination.

Parameters
clientMessage:Message<P>

the client message related to the error, possibly null if error occurred while parsing a WebSocket message

ex:Throwable

the cause for the error, never null

Returns:Message<P>

the error message to send to the client, or null in which case no message will be sent.

Annotations
@Nullable
handleErrorMessageToClientback to summary
public Message<P> handleErrorMessageToClient(Message<P> errorMessage)

Handle errors sent from the server side to clients, e.g. errors from the "broke relay" because connectivity failed or the external broker sent an error message, etc.

Parameters
errorMessage:Message<P>

the error message, never null

Returns:Message<P>

the error message to send to the client, or null in which case no message will be sent.

Annotations
@Nullable