io.undertow.websockets

## Class WebSocketProtocolHandshakeHandler

- java.lang.Object
- - io.undertow.websockets.WebSocketProtocolHandshakeHandler

All Implemented Interfaces:
  HttpHandler

    public class WebSocketProtocolHandshakeHandler
    extends Object
    implements HttpHandler

`HttpHandler` which will process the `HttpServerExchange` and do the actual handshake/upgrade to WebSocket.

Author:
  Norman Maurer

### Constructor Summary

Constructors
Constructor and Description
`WebSocketProtocolHandshakeHandler(Collection<Handshake> handshakes, HttpUpgradeListener callback)` Create a new `WebSocketProtocolHandshakeHandler`
`WebSocketProtocolHandshakeHandler(Collection<Handshake> handshakes, HttpUpgradeListener callback, HttpHandler next)` Create a new `WebSocketProtocolHandshakeHandler`
`WebSocketProtocolHandshakeHandler(Collection<Handshake> handshakes, WebSocketConnectionCallback callback)` Create a new `WebSocketProtocolHandshakeHandler`
`WebSocketProtocolHandshakeHandler(Collection<Handshake> handshakes, WebSocketConnectionCallback callback, HttpHandler next)` Create a new `WebSocketProtocolHandshakeHandler`
`WebSocketProtocolHandshakeHandler(HttpUpgradeListener callback)` Create a new `WebSocketProtocolHandshakeHandler`
`WebSocketProtocolHandshakeHandler(HttpUpgradeListener callback, HttpHandler next)` Create a new `WebSocketProtocolHandshakeHandler`
`WebSocketProtocolHandshakeHandler(WebSocketConnectionCallback callback)` Create a new `WebSocketProtocolHandshakeHandler`
`WebSocketProtocolHandshakeHandler(WebSocketConnectionCallback callback, HttpHandler next)` Create a new `WebSocketProtocolHandshakeHandler`

### Method Summary

All Methods Instance Methods Concrete Methods
`WebSocketProtocolHandshakeHandler` `addExtension(ExtensionHandshake extension)` Add a new WebSocket Extension into the handshakes defined in this handler.
`Set<WebSocketChannel>` `getPeerConnections()`
`void` `handleRequest(HttpServerExchange exchange)` Handle the request.

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

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

### Constructor Detail

#### WebSocketProtocolHandshakeHandler

    public WebSocketProtocolHandshakeHandler(WebSocketConnectionCallback callback)

Create a new `WebSocketProtocolHandshakeHandler`

Parameters:
  `callback` - The `WebSocketConnectionCallback` which will be executed once the handshake was established

#### WebSocketProtocolHandshakeHandler

    public WebSocketProtocolHandshakeHandler(WebSocketConnectionCallback callback,
                                             HttpHandler next)

Create a new `WebSocketProtocolHandshakeHandler`

Parameters:
  `callback` - The `WebSocketConnectionCallback` which will be executed once the handshake was established

#### WebSocketProtocolHandshakeHandler

    public WebSocketProtocolHandshakeHandler(Collection<Handshake> handshakes,
                                             WebSocketConnectionCallback callback)

Create a new `WebSocketProtocolHandshakeHandler`

Parameters:
  `handshakes` - The supported handshake methods
  `callback` - The `WebSocketConnectionCallback` which will be executed once the handshake was established

#### WebSocketProtocolHandshakeHandler

    public WebSocketProtocolHandshakeHandler(Collection<Handshake> handshakes,
                                             WebSocketConnectionCallback callback,
                                             HttpHandler next)

Create a new `WebSocketProtocolHandshakeHandler`

Parameters:
  `handshakes` - The supported handshake methods
  `callback` - The `WebSocketConnectionCallback` which will be executed once the handshake was established

#### WebSocketProtocolHandshakeHandler

    public WebSocketProtocolHandshakeHandler(HttpUpgradeListener callback)

Create a new `WebSocketProtocolHandshakeHandler`

Parameters:
  `callback` - The `WebSocketConnectionCallback` which will be executed once the handshake was established

#### WebSocketProtocolHandshakeHandler

    public WebSocketProtocolHandshakeHandler(HttpUpgradeListener callback,
                                             HttpHandler next)

Create a new `WebSocketProtocolHandshakeHandler`

Parameters:
  `callback` - The `WebSocketConnectionCallback` which will be executed once the handshake was established

#### WebSocketProtocolHandshakeHandler

    public WebSocketProtocolHandshakeHandler(Collection<Handshake> handshakes,
                                             HttpUpgradeListener callback)

Create a new `WebSocketProtocolHandshakeHandler`

Parameters:
  `handshakes` - The supported handshake methods
  `callback` - The `WebSocketConnectionCallback` which will be executed once the handshake was established

#### WebSocketProtocolHandshakeHandler

    public WebSocketProtocolHandshakeHandler(Collection<Handshake> handshakes,
                                             HttpUpgradeListener callback,
                                             HttpHandler next)

Create a new `WebSocketProtocolHandshakeHandler`

Parameters:
  `handshakes` - The supported handshake methods
  `callback` - The `WebSocketConnectionCallback` which will be executed once the handshake was established

### Method Detail

#### handleRequest

    public void handleRequest(HttpServerExchange exchange)
                       throws Exception

Description copied from interface: `HttpHandler`
Handle the request.

Specified by:
  `handleRequest` in interface `HttpHandler`
Parameters:
  `exchange` - the HTTP request/response exchange
Throws:
  `Exception`

#### getPeerConnections

    public Set<WebSocketChannel> getPeerConnections()

#### addExtension

    public WebSocketProtocolHandshakeHandler addExtension(ExtensionHandshake extension)

Add a new WebSocket Extension into the handshakes defined in this handler.

Parameters:
  `extension` - a new `ExtensionHandshake` instance
Returns:
  current handler