JavaScript is disabled on your browser.
Skip navigation links
io.netty.handler.codec.http.websocketx

Class WebSocketServerHandshaker

    • Field Detail

      • logger

        protected static final io.netty.util.internal.logging.InternalLogger logger
      • SUB_PROTOCOL_WILDCARD

        public static final java.lang.String SUB_PROTOCOL_WILDCARD
        Use this as wildcard to support all requested sub-protocols
        See Also:
        Constant Field Values
    • Constructor Detail

      • WebSocketServerHandshaker

        protected WebSocketServerHandshaker(WebSocketVersion version,
         java.lang.String uri,
         java.lang.String subprotocols,
         int maxFramePayloadLength)
        Constructor specifying the destination web socket location
        Parameters:
        version - the protocol version
        uri - 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. Null if sub protocols not supported.
        maxFramePayloadLength - Maximum length of a frame's payload
    • Method Detail

      • uri

        public java.lang.String uri()
        Returns the URL of the web socket
      • subprotocols

        public java.util.Set<java.lang.String> subprotocols()
        Returns the CSV of supported sub protocols
      • version

        public WebSocketVersion version()
        Returns the version of the specification being supported
      • maxFramePayloadLength

        public int maxFramePayloadLength()
        Gets the maximum length for any frame's payload.
        Returns:
        The maximum length for a frame's payload
      • handshake

        public ChannelFuture handshake(Channel channel,
         FullHttpRequest req)
        Performs the opening handshake. When call this method you MUST NOT retain the FullHttpRequest which is passed in.
        Parameters:
        channel - Channel
        req - HTTP Request
        Returns:
        future The ChannelFuture which is notified once the opening handshake completes
      • handshake

        public final ChannelFuture handshake(Channel channel,
         FullHttpRequest req,
         HttpHeaders responseHeaders,
         ChannelPromise promise)
        Performs the opening handshake When call this method you MUST NOT retain the FullHttpRequest which is passed in.
        Parameters:
        channel - Channel
        req - HTTP Request
        responseHeaders - Extra headers to add to the handshake response or null if no extra headers should be added
        promise - the ChannelPromise to be notified when the opening handshake is done
        Returns:
        future the ChannelFuture which is notified when the opening handshake is done
      • handshake

        public ChannelFuture handshake(Channel channel,
         HttpRequest req)
        Performs the opening handshake. When call this method you MUST NOT retain the FullHttpRequest which is passed in.
        Parameters:
        channel - Channel
        req - HTTP Request
        Returns:
        future The ChannelFuture which is notified once the opening handshake completes
      • handshake

        public final ChannelFuture handshake(Channel channel,
         HttpRequest req,
         HttpHeaders responseHeaders,
         ChannelPromise promise)
        Performs the opening handshake When call this method you MUST NOT retain the HttpRequest which is passed in.
        Parameters:
        channel - Channel
        req - HTTP Request
        responseHeaders - Extra headers to add to the handshake response or null if no extra headers should be added
        promise - the ChannelPromise to be notified when the opening handshake is done
        Returns:
        future the ChannelFuture which is notified when the opening handshake is done
      • newHandshakeResponse

        protected abstract FullHttpResponse newHandshakeResponse(FullHttpRequest req,
         HttpHeaders responseHeaders)
        Returns a new {@link FullHttpResponse) which will be used for as response to the handshake request.
      • selectSubprotocol

        protected java.lang.String selectSubprotocol(java.lang.String requestedSubprotocols)
        Selects the first matching supported sub protocol
        Parameters:
        requestedSubprotocols - CSV of protocols to be supported. e.g. "chat, superchat"
        Returns:
        First matching supported sub protocol. Null if not found.
      • selectedSubprotocol

        public java.lang.String selectedSubprotocol()
        Returns the selected subprotocol. Null if no subprotocol has been selected.

        This is only available AFTER handshake() has been called.

      • newWebsocketDecoder

        protected abstract WebSocketFrameDecoder newWebsocketDecoder()
        Returns the decoder to use after handshake is complete.
      • newWebSocketEncoder

        protected abstract WebSocketFrameEncoder newWebSocketEncoder()
        Returns the encoder to use after the handshake is complete.
Skip navigation links

Copyright © 2008–2018 The Netty Project. All rights reserved.

AltStyle によって変換されたページ (->オリジナル) /