Class WebSocketClientHandshaker

java.lang.Object
io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker
Direct Known Subclasses:
WebSocketClientHandshaker00, WebSocketClientHandshaker07, WebSocketClientHandshaker08, WebSocketClientHandshaker13

public abstract class WebSocketClientHandshaker extends Object
Base class for web socket client handshake implementations
  • Field Details

    • HTTP_SCHEME_PREFIX

      private static final String HTTP_SCHEME_PREFIX
    • HTTPS_SCHEME_PREFIX

      private static final String HTTPS_SCHEME_PREFIX
    • DEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS

      protected static final int DEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS
      See Also:
    • uri

      private final URI uri
    • version

      private final WebSocketVersion version
    • handshakeComplete

      private volatile boolean handshakeComplete
    • forceCloseTimeoutMillis

      private volatile long forceCloseTimeoutMillis
    • forceCloseInit

      private volatile int forceCloseInit
    • FORCE_CLOSE_INIT_UPDATER

      private static final AtomicIntegerFieldUpdater<WebSocketClientHandshaker> FORCE_CLOSE_INIT_UPDATER
    • forceCloseComplete

      private volatile boolean forceCloseComplete
    • expectedSubprotocol

      private final String expectedSubprotocol
    • actualSubprotocol

      private volatile String actualSubprotocol
    • customHeaders

      protected final HttpHeaders customHeaders
    • maxFramePayloadLength

      private final int maxFramePayloadLength
    • absoluteUpgradeUrl

      private final boolean absoluteUpgradeUrl
    • generateOriginHeader

      protected final boolean generateOriginHeader
  • Constructor Details

    • WebSocketClientHandshaker

      protected WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol, HttpHeaders customHeaders, int maxFramePayloadLength)
      Base constructor
      Parameters:
      uri - URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
      version - Version of web socket specification to use to connect to the server
      subprotocol - Sub protocol request sent to the server.
      customHeaders - Map of custom headers to add to the client request
      maxFramePayloadLength - Maximum length of a frame's payload
    • WebSocketClientHandshaker

      protected WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol, HttpHeaders customHeaders, int maxFramePayloadLength, long forceCloseTimeoutMillis)
      Base constructor
      Parameters:
      uri - URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
      version - Version of web socket specification to use to connect to the server
      subprotocol - Sub protocol request sent to the server.
      customHeaders - Map of custom headers to add to the client request
      maxFramePayloadLength - Maximum length of a frame's payload
      forceCloseTimeoutMillis - Close the connection if it was not closed by the server after timeout specified
    • WebSocketClientHandshaker

      protected WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol, HttpHeaders customHeaders, int maxFramePayloadLength, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl)
      Base constructor
      Parameters:
      uri - URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
      version - Version of web socket specification to use to connect to the server
      subprotocol - Sub protocol request sent to the server.
      customHeaders - Map of custom headers to add to the client request
      maxFramePayloadLength - Maximum length of a frame's payload
      forceCloseTimeoutMillis - Close the connection if it was not closed by the server after timeout specified
      absoluteUpgradeUrl - Use an absolute url for the Upgrade request, typically when connecting through an HTTP proxy over clear HTTP
    • WebSocketClientHandshaker

      protected WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol, HttpHeaders customHeaders, int maxFramePayloadLength, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, boolean generateOriginHeader)
      Base constructor
      Parameters:
      uri - URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
      version - Version of web socket specification to use to connect to the server
      subprotocol - Sub protocol request sent to the server.
      customHeaders - Map of custom headers to add to the client request
      maxFramePayloadLength - Maximum length of a frame's payload
      forceCloseTimeoutMillis - Close the connection if it was not closed by the server after timeout specified
      absoluteUpgradeUrl - Use an absolute url for the Upgrade request, typically when connecting through an HTTP proxy over clear HTTP
      generateOriginHeader - Allows to generate the `Origin`|`Sec-WebSocket-Origin` header value for handshake request according to the given webSocketURL
  • Method Details