Home / Class/ WebSocketClientProtocolHandler Class — netty Architecture

WebSocketClientProtocolHandler Class — netty Architecture

Architecture documentation for the WebSocketClientProtocolHandler class in WebSocketClientProtocolHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  8f516d99_55b7_3f71_2f8e_9950c027e22a["WebSocketClientProtocolHandler"]
  a1626427_cdf2_f684_d0cc_8e4133b726d3["WebSocketClientProtocolHandler.java"]
  8f516d99_55b7_3f71_2f8e_9950c027e22a -->|defined in| a1626427_cdf2_f684_d0cc_8e4133b726d3
  b907a89f_f62f_7102_1661_5994c3bbe776["WebSocketClientHandshaker()"]
  8f516d99_55b7_3f71_2f8e_9950c027e22a -->|method| b907a89f_f62f_7102_1661_5994c3bbe776
  6ff5283a_b554_cb52_b7ac_f5bbc9e43c53["WebSocketClientProtocolHandler()"]
  8f516d99_55b7_3f71_2f8e_9950c027e22a -->|method| 6ff5283a_b554_cb52_b7ac_f5bbc9e43c53
  629c9cff_29ee_f3c5_8677_049a8f543199["decode()"]
  8f516d99_55b7_3f71_2f8e_9950c027e22a -->|method| 629c9cff_29ee_f3c5_8677_049a8f543199
  3e1e157d_c95e_7ddc_98e1_589633cb3a7e["WebSocketClientHandshakeException()"]
  8f516d99_55b7_3f71_2f8e_9950c027e22a -->|method| 3e1e157d_c95e_7ddc_98e1_589633cb3a7e
  55bd71a9_e2be_3479_59aa_5ee98876185b["handlerAdded()"]
  8f516d99_55b7_3f71_2f8e_9950c027e22a -->|method| 55bd71a9_e2be_3479_59aa_5ee98876185b

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientProtocolHandler.java lines 48–434

public class WebSocketClientProtocolHandler extends WebSocketProtocolHandler {
    private final WebSocketClientHandshaker handshaker;
    private final WebSocketClientProtocolConfig clientConfig;

    /**
     * Returns the used handshaker
     */
    public WebSocketClientHandshaker handshaker() {
        return handshaker;
    }

    /**
     * Events that are fired to notify about handshake status
     */
    public enum ClientHandshakeStateEvent {
        /**
         * The Handshake was timed out
         */
        HANDSHAKE_TIMEOUT,

        /**
         * The Handshake was started but the server did not response yet to the request
         */
        HANDSHAKE_ISSUED,

        /**
         * The Handshake was complete successful and so the channel was upgraded to websockets
         */
        HANDSHAKE_COMPLETE
    }

    /**
     * Base constructor
     *
     * @param clientConfig
     *            Client protocol configuration.
     */
    public WebSocketClientProtocolHandler(WebSocketClientProtocolConfig clientConfig) {
        super(checkNotNull(clientConfig, "clientConfig").dropPongFrames(),
              clientConfig.sendCloseFrame(), clientConfig.forceCloseTimeoutMillis());
        this.handshaker = WebSocketClientHandshakerFactory.newHandshaker(
            clientConfig.webSocketUri(),
            clientConfig.version(),
            clientConfig.subprotocol(),
            clientConfig.allowExtensions(),
            clientConfig.customHeaders(),
            clientConfig.maxFramePayloadLength(),
            clientConfig.performMasking(),
            clientConfig.allowMaskMismatch(),
            clientConfig.forceCloseTimeoutMillis(),
            clientConfig.absoluteUpgradeUrl(),
            clientConfig.generateOriginHeader()
        );
        this.clientConfig = clientConfig;
    }

    /**
     * Base constructor
     *
     * @param handshaker
     *            The {@link WebSocketClientHandshaker} which will be used to issue the handshake once the connection
     *            was established to the remote peer.
     * @param clientConfig
     *            Client protocol configuration.
     */
    public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker,
                                          WebSocketClientProtocolConfig clientConfig) {
        super(checkNotNull(clientConfig, "clientConfig").dropPongFrames(),
              clientConfig.sendCloseFrame(), clientConfig.forceCloseTimeoutMillis());
        this.handshaker = handshaker;
        this.clientConfig = clientConfig;
    }

    /**
     * Base constructor
     *
     * @param webSocketURL
     *            URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
     *            sent to this URL.
     * @param version
     *            Version of web socket specification to use to connect to the server

Frequently Asked Questions

What is the WebSocketClientProtocolHandler class?
WebSocketClientProtocolHandler is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientProtocolHandler.java.
Where is WebSocketClientProtocolHandler defined?
WebSocketClientProtocolHandler is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientProtocolHandler.java at line 48.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free