Class WebSocketUtils


  • public final class WebSocketUtils
    extends Object
    WebSocket utility methods.
    • Field Detail

      • UPGRADE_HEADER_NAME

        public static final String UPGRADE_HEADER_NAME
        HTTP WebSocket header name used to determine if a request represents a WebSocket upgrade.
        See Also:
        Constant Field Values
      • UPGRADE_HEADER_VALUE

        public static final String UPGRADE_HEADER_VALUE
        Value for header name "Upgrade", indicating that the request represents a WebSocket.
        See Also:
        Constant Field Values
      • WS_VERSION_HEADER_NAME

        public static final String WS_VERSION_HEADER_NAME
        HTTP WebSocket header name used to determine WebSocket version.
        See Also:
        Constant Field Values
      • WS_KEY_HEADER_NAME

        public static final String WS_KEY_HEADER_NAME
        HTTP WebSocket header name used to identify the WebSocket key.
        See Also:
        Constant Field Values
      • WS_PROTOCOL_HEADER_NAME

        public static final String WS_PROTOCOL_HEADER_NAME
        HTTP WebSocket header name used to identify the WebSocket protocol.
        See Also:
        Constant Field Values
    • Method Detail

      • isWebSocketHandshake

        public static boolean isWebSocketHandshake​(Request request)
        Returns true if this request represents a WebSocket handshake.
        Parameters:
        request - the Request to check for upgrade
        Returns:
        true if this is a WebSocket handshake, otherwise false