org.springframework.web.socket.server

## Interface HandshakeInterceptor

All Known Implementing Classes:
  HttpSessionHandshakeInterceptor, OriginHandshakeInterceptor

    public interface HandshakeInterceptor

Interceptor for WebSocket handshake requests. Can be used to inspect the handshake request and response as well as to pass attributes to the target `WebSocketHandler`.

Since:
  4.0
Author:
  Rossen Stoyanchev
See Also:
  `WebSocketHttpRequestHandler`, `DefaultSockJsService`

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `afterHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, WebSocketHandler wsHandler, Exception exception)` Invoked after the handshake is done.
`boolean` `beforeHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, WebSocketHandler wsHandler, Map<String,Object> attributes)` Invoked before the handshake is processed.

### Method Detail

#### beforeHandshake

    boolean beforeHandshake(org.springframework.http.server.ServerHttpRequest request,
                            org.springframework.http.server.ServerHttpResponse response,
                            WebSocketHandler wsHandler,
                            Map<String,Object> attributes)
                     throws Exception

Invoked before the handshake is processed.

Parameters:
  `request` - the current request
  `response` - the current response
  `wsHandler` - the target WebSocket handler
  `attributes` - the attributes from the HTTP handshake to associate with the WebSocket session; the provided attributes are copied, the original map is not used.
Returns:
  whether to proceed with the handshake (`true`) or abort (`false`)
Throws:
  `Exception`

#### afterHandshake

    void afterHandshake(org.springframework.http.server.ServerHttpRequest request,
                        org.springframework.http.server.ServerHttpResponse response,
                        WebSocketHandler wsHandler,
                        @Nullable
                        Exception exception)

Invoked after the handshake is done. The response status and headers indicate the results of the handshake, i.e. whether it was successful or not.

Parameters:
  `request` - the current request
  `response` - the current response
  `wsHandler` - the target WebSocket handler
  `exception` - an exception raised during the handshake, or `null` if none