Class WebSocketCapabilities

java.lang.Object
io.fluxzero.common.websocket.WebSocketCapabilities

public final class WebSocketCapabilities extends Object
Utility methods for exchanging Fluxzero websocket client capabilities through handshake headers.
  • Field Details

    • SUPPORTED_DOCUMENT_COMPRESSION_HEADER

      public static final String SUPPORTED_DOCUMENT_COMPRESSION_HEADER
      Supported document compression codecs; stored bytes are preserved when the client knows their codec.
      See Also:
    • SUPPORTED_MODEL_MEMBERSHIP_VERSIONS_HEADER

      public static final String SUPPORTED_MODEL_MEMBERSHIP_VERSIONS_HEADER
      Explicit packed Model membership versions understood by this client (independent of transport format).
      See Also:
    • SUPPORTS_MIXED_MODEL_EVENT_BLOCKS_HEADER

      public static final String SUPPORTS_MIXED_MODEL_EVENT_BLOCKS_HEADER
      This reader accepts mixed legacy and binary records within one compact Model-event block.
      See Also:
    • SUPPORTED_COMPRESSION_ALGORITHMS_HEADER

      public static final String SUPPORTED_COMPRESSION_ALGORITHMS_HEADER
      See Also:
    • SELECTED_COMPRESSION_ALGORITHM_HEADER

      public static final String SELECTED_COMPRESSION_ALGORITHM_HEADER
      See Also:
    • SUPPORTED_TRANSPORT_FORMATS_HEADER

      public static final String SUPPORTED_TRANSPORT_FORMATS_HEADER
      See Also:
    • SELECTED_TRANSPORT_FORMAT_HEADER

      public static final String SELECTED_TRANSPORT_FORMAT_HEADER
      See Also:
    • CLIENT_SESSION_ID_HEADER

      public static final String CLIENT_SESSION_ID_HEADER
      See Also:
    • REPLACES_SESSION_ID_HEADER

      public static final String REPLACES_SESSION_ID_HEADER
      See Also:
    • CLIENT_SDK_VERSION_HEADER

      public static final String CLIENT_SDK_VERSION_HEADER
      See Also:
    • RUNTIME_SESSION_ID_HEADER

      public static final String RUNTIME_SESSION_ID_HEADER
      See Also:
    • RUNTIME_VERSION_HEADER

      public static final String RUNTIME_VERSION_HEADER
      See Also:
    • MODEL_IDENTITY_SELECTION_VERSION_HEADER

      public static final String MODEL_IDENTITY_SELECTION_VERSION_HEADER
      Explicit primary/alias selection and atomic alias-owner observations understood by the server.
      See Also:
    • CONSUMER_FILTER_VERSIONS_HEADER

      public static final String CONSUMER_FILTER_VERSIONS_HEADER
      Filter languages accepted by the server, including live refresh and independent scan/idle boundaries.
      See Also:
    • MESSAGE_ENVELOPE_VERSION_HEADER

      public static final String MESSAGE_ENVELOPE_VERSION_HEADER
      Highest native message envelope version this peer can read, including packed Model-event blocks.
      See Also:
  • Method Details

    • supportsModelIdentitySelection

      public static boolean supportsModelIdentitySelection(Map<String, List<String>> headers)
      Missing or unknown capability versions never enable explicit identity selection.
    • supportsConsumerFiltering

      public static boolean supportsConsumerFiltering(Map<String, List<String>> headers)
      Whether this peer advertises the consumer filter language understood by this SDK. Missing means unsupported.
    • supportsRoutedEnvelopes

      public static boolean supportsRoutedEnvelopes(Map<String, List<String>> headers)
      Routed native envelopes are sent only after an explicit peer capability. Missing means v1.
    • asHeaders

      public static Map<String, List<String>> asHeaders(Collection<CompressionAlgorithm> supportedCompressionAlgorithms)
      Serializes the supplied compression capabilities into websocket request headers.
      Parameters:
      supportedCompressionAlgorithms - ordered list of supported compression algorithms, most preferred first
      Returns:
      websocket request headers representing the supplied capabilities
    • asTransportHeaders

      public static Map<String, List<String>> asTransportHeaders(Collection<WebSocketTransportFormat> supportedTransportFormats)
      Serializes the supplied websocket transport formats into websocket request headers.
      Parameters:
      supportedTransportFormats - ordered list of supported transport formats, most preferred first
      Returns:
      websocket request headers representing the supplied transport capabilities
    • getSupportedCompressionAlgorithms

      public static List<CompressionAlgorithm> getSupportedCompressionAlgorithms(Map<String, List<String>> headers)
      Extracts the ordered list of compression algorithms from websocket request headers.
    • getPreferredCompressionAlgorithm

      public static Optional<CompressionAlgorithm> getPreferredCompressionAlgorithm(Map<String, List<String>> headers)
      Returns the most preferred compression algorithm advertised via request headers, if available.
    • getSelectedCompressionAlgorithm

      public static Optional<CompressionAlgorithm> getSelectedCompressionAlgorithm(Map<String, List<String>> headers)
      Reads the negotiated compression algorithm from handshake headers, returning empty for a missing or unrecognized selection.
    • getSupportedTransportFormats

      public static List<WebSocketTransportFormat> getSupportedTransportFormats(Map<String, List<String>> headers)
      Extracts the ordered list of websocket transport formats from websocket request headers.
    • getPreferredTransportFormat

      public static Optional<WebSocketTransportFormat> getPreferredTransportFormat(Map<String, List<String>> headers)
      Returns the most preferred websocket transport format advertised via request headers, if available.
    • getSelectedTransportFormat

      public static Optional<WebSocketTransportFormat> getSelectedTransportFormat(Map<String, List<String>> headers)
      Reads the negotiated transport format from handshake headers, returning empty for a missing or unrecognized selection.
    • getClientSessionId

      public static Optional<String> getClientSessionId(Map<String, List<String>> headers)
      Reads the client's session identifier from handshake headers, if present.
    • getReplacedSessionId

      public static Optional<String> getReplacedSessionId(Map<String, List<String>> headers)
      Reads the identifier of the session being replaced by this connection, if present.
    • getClientSdkVersion

      public static Optional<String> getClientSdkVersion(Map<String, List<String>> headers)
      Reads the advertised client SDK version from handshake headers, if present.
    • getRuntimeSessionId

      public static Optional<String> getRuntimeSessionId(Map<String, List<String>> headers)
      Reads the Runtime session identifier from handshake headers, if present.
    • getRuntimeVersion

      public static Optional<String> getRuntimeVersion(Map<String, List<String>> headers)
      Reads the advertised Runtime version from handshake headers, if present.
    • newShortSessionId

      public static String newShortSessionId()
      Generates a twelve-character hexadecimal session identifier from a random UUID.