Interface WebSocketHandshake

  • All Known Implementing Classes:
    AbstractWebSocketHandshake

    public interface WebSocketHandshake
    Represents a websocket handshake. Helps negotiate subprotocols, extensions, etc. See https://tools.ietf.org/html/rfc6455.
    Author:
    jjlauer
    • Method Detail

      • getRequestedProtocols

        Set<String> getRequestedProtocols()
        The sub protocols requested by the client. Will be ordered to match the order sent by the client.
        Returns:
        The set of sub protocols requested by the client or null if the header was empty or never sent by the client.
      • getSelectedProtocol

        String getSelectedProtocol()
        Gets the current selected sub protocol out of the requested sub protocols.
        Returns:
        The selected sub protocol or null if none are selected
      • selectProtocol

        boolean selectProtocol​(String protocol)
        Selects the first matching supported sub protocol out of the requested sub protocols. Most browsers and WebSocket implementations require a match from the list supplied by the client or the handshake will fail.
        Parameters:
        protocol -
        Returns:
        True if selected or false if none matched