spring-framework / org.springframework.web.socket.messaging / SubProtocolErrorHandler

SubProtocolErrorHandler

interface SubProtocolErrorHandler<P : Any>

A contract for handling sub-protocol errors sent to clients.

Author
Rossen Stoyanchev

Since
4.2

Functions

handleClientMessageProcessingError

abstract fun handleClientMessageProcessingError(clientMessage: Message<P>, ex: Throwable): Message<P>

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.

handleErrorMessageToClient

abstract fun handleErrorMessageToClient(errorMessage: Message<P>): Message<P>

Handle errors sent from the server side to clients, e.g. errors from the org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler because connectivity failed or the external broker sent an error message, etc.