org.springframework.web.socket.handler

## Class LoggingWebSocketHandlerDecorator

- java.lang.Object
- - org.springframework.web.socket.handler.WebSocketHandlerDecorator
  - - org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator

All Implemented Interfaces:
  WebSocketHandler

    public class LoggingWebSocketHandlerDecorator
    extends WebSocketHandlerDecorator

A `WebSocketHandlerDecorator` that adds logging to WebSocket lifecycle events.

Since:
  4.0
Author:
  Rossen Stoyanchev

### Constructor Summary

Constructors
Constructor and Description
`LoggingWebSocketHandlerDecorator(WebSocketHandler delegate)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)` Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred.
`void` `afterConnectionEstablished(WebSocketSession session)` Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.
`void` `handleMessage(WebSocketSession session, WebSocketMessage<?> message)` Invoked when a new WebSocket message arrives.
`void` `handleTransportError(WebSocketSession session, Throwable exception)` Handle an error from the underlying WebSocket message transport.

### Methods inherited from class org.springframework.web.socket.handler.WebSocketHandlerDecorator

`getDelegate, getLastHandler, supportsPartialMessages, toString, unwrap`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### LoggingWebSocketHandlerDecorator

    public LoggingWebSocketHandlerDecorator(WebSocketHandler delegate)

### Method Detail

#### afterConnectionEstablished

    public void afterConnectionEstablished(WebSocketSession session)
                                    throws Exception

Description copied from interface: `WebSocketHandler`
Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.

Specified by:
  `afterConnectionEstablished` in interface `WebSocketHandler`
Overrides:
  `afterConnectionEstablished` in class `WebSocketHandlerDecorator`
Throws:
  `Exception` - this method can handle or propagate exceptions; see class-level Javadoc for details.

#### handleMessage

    public void handleMessage(WebSocketSession session,
                              WebSocketMessage<?> message)
                       throws Exception

Description copied from interface: `WebSocketHandler`
Invoked when a new WebSocket message arrives.

Specified by:
  `handleMessage` in interface `WebSocketHandler`
Overrides:
  `handleMessage` in class `WebSocketHandlerDecorator`
Throws:
  `Exception` - this method can handle or propagate exceptions; see class-level Javadoc for details.

#### handleTransportError

    public void handleTransportError(WebSocketSession session,
                                     Throwable exception)
                              throws Exception

Description copied from interface: `WebSocketHandler`
Handle an error from the underlying WebSocket message transport.

Specified by:
  `handleTransportError` in interface `WebSocketHandler`
Overrides:
  `handleTransportError` in class `WebSocketHandlerDecorator`
Throws:
  `Exception` - this method can handle or propagate exceptions; see class-level Javadoc for details.

#### afterConnectionClosed

    public void afterConnectionClosed(WebSocketSession session,
                                      CloseStatus closeStatus)
                               throws Exception

Description copied from interface: `WebSocketHandler`
Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred. Although the session may technically still be open, depending on the underlying implementation, sending messages at this point is discouraged and most likely will not succeed.

Specified by:
  `afterConnectionClosed` in interface `WebSocketHandler`
Overrides:
  `afterConnectionClosed` in class `WebSocketHandlerDecorator`
Throws:
  `Exception` - this method can handle or propagate exceptions; see class-level Javadoc for details.