Class WebSocketServerHandshaker00

    • Constructor Detail

      • WebSocketServerHandshaker00

        public WebSocketServerHandshaker00​(java.lang.String webSocketURL,
                                           java.lang.String subprotocols)
        Constructor with default values
        Parameters:
        webSocketURL - URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
        subprotocols - CSV of supported protocols
      • WebSocketServerHandshaker00

        public WebSocketServerHandshaker00​(java.lang.String webSocketURL,
                                           java.lang.String subprotocols,
                                           long maxFramePayloadLength)
        Constructor specifying the destination web socket location
        Parameters:
        webSocketURL - URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
        subprotocols - CSV of supported protocols
        maxFramePayloadLength - Maximum allowable frame payload length. Setting this value to your application's requirement may reduce denial of service attacks using long data frames.
    • Method Detail

      • handshake

        public ChannelFuture handshake​(Channel channel,
                                       HttpRequest req)

        Handle the web socket handshake for the web socket specification HyBi version 0 and lower. This standard is really a rehash of hixie-76 and hixie-75.

        Browser request to the server:

         GET /demo HTTP/1.1
         Upgrade: WebSocket
         Connection: Upgrade
         Host: example.com
         Origin: http://example.com
         Sec-WebSocket-Protocol: chat, sample
         Sec-WebSocket-Key1: 4 @1  46546xW%0l 1 5
         Sec-WebSocket-Key2: 12998 5 Y3 1  .P00
        
         ^n:ds[4U
         

        Server response:

         HTTP/1.1 101 WebSocket Protocol Handshake
         Upgrade: WebSocket
         Connection: Upgrade
         Sec-WebSocket-Origin: http://example.com
         Sec-WebSocket-Location: ws://example.com/demo
         Sec-WebSocket-Protocol: sample
        
         8jKS'y:G*Co,Wxa-
         
        Specified by:
        handshake in class WebSocketServerHandshaker
        Parameters:
        channel - Channel
        req - HTTP request