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

public Interface HandshakeHandler

Known Direct Implementers
org.springframework.web.socket.server.support.AbstractHandshakeHandler, org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler
Imports
java.util.Map, org.springframework.http.server.ServerHttpRequest, .ServerHttpResponse, org.springframework.web.socket.WebSocketHandler, org.springframework.web.socket.handler.PerConnectionWebSocketHandler

Contract for processing a WebSocket handshake request.
Author
Rossen Stoyanchev
Since
4.0
See Also
HandshakeInterceptor, org.springframework.web.socket.server.support.WebSocketHttpRequestHandler, org.springframework.web.socket.sockjs.SockJsService

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether the handshake negotiation was successful or not. In either case the response status, headers, and body will have been updated to reflect the result of the negotiation
doHandshake
(ServerHttpRequest
the current request
request
,
ServerHttpResponse
the current response
response
,
WebSocketHandler
the handler to process WebSocket messages; see PerConnectionWebSocketHandler for providing a handler with per-connection lifecycle.
wsHandler
,
Map<String, Object>
the attributes from the HTTP handshake to associate with the WebSocket session; the provided attributes are copied, the original map is not used.
attributes
)

Initiate the handshake.

Method Detail

doHandshakeback to summary
public boolean doHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) throws HandshakeFailureException

Initiate the handshake.

Parameters
request:ServerHttpRequest

the current request

response:ServerHttpResponse

the current response

wsHandler:WebSocketHandler

the handler to process WebSocket messages; see PerConnectionWebSocketHandler for providing a handler with per-connection lifecycle.

attributes:Map<String, Object>

the attributes from the HTTP handshake to associate with the WebSocket session; the provided attributes are copied, the original map is not used.

Returns:boolean

whether the handshake negotiation was successful or not. In either case the response status, headers, and body will have been updated to reflect the result of the negotiation

Exceptions
HandshakeFailureException:
thrown when handshake processing failed to complete due to an internal, unrecoverable error, i.e. a server error as opposed to a failure to successfully negotiate the handshake.