Class WebSocketHandlerImpl

    • Constructor Detail

      • WebSocketHandlerImpl

        public WebSocketHandlerImpl()
    • Method Detail

      • createUpgradeRequest

        public String createUpgradeRequest​(String hostName,
                                           String webSocketPath,
                                           String webSocketQuery,
                                           int webSocketPort,
                                           String webSocketProtocol,
                                           Map<String,​String> additionalHeaders)
        Description copied from interface: WebSocketHandler
        Creates an HTTP request to upgrade to use web sockets.
        Specified by:
        createUpgradeRequest in interface WebSocketHandler
        Parameters:
        hostName - Name of the host.
        webSocketPath - Path for the websocket.
        webSocketQuery - Query for the web socket.
        webSocketPort - Port for web socket.
        webSocketProtocol - Protocol to use for web sockets.
        additionalHeaders - Any additional headers to add to the HTTP upgrade request.
        Returns:
        Represents the HTTP request.
      • createPong

        public void createPong​(ByteBuffer ping,
                               ByteBuffer pong)
        Description copied from interface: WebSocketHandler
        Creates the pong for the "keep-alive", heart beat, network status probing when connecting in a web socket.
        Specified by:
        createPong in interface WebSocketHandler
        Parameters:
        ping - The source buffer to read from.
        pong - The destination buffer with the pong.
        See Also:
        Ping and pong
      • wrapBuffer

        public void wrapBuffer​(ByteBuffer srcBuffer,
                               ByteBuffer dstBuffer)
        Description copied from interface: WebSocketHandler
        Wraps the source buffer with additional contents from the web socket.
        Specified by:
        wrapBuffer in interface WebSocketHandler
        Parameters:
        srcBuffer - Source buffer to wrap input.
        dstBuffer - Output buffer that bytes are written to.
      • createRandomMaskingKey

        protected byte[] createRandomMaskingKey()
      • calculateHeaderSize

        public int calculateHeaderSize​(int payloadSize)
        Description copied from interface: WebSocketHandler
        Gets the size of the header.
        Specified by:
        calculateHeaderSize in interface WebSocketHandler
        Parameters:
        payloadSize - Size of the payload.
        Returns:
        The size of the header.