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

  • Method Details

    • 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
    • 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)
    • getClientSessionId

      public static Optional<String> getClientSessionId(Map<String, List<String>> headers)
    • getRuntimeSessionId

      public static Optional<String> getRuntimeSessionId(Map<String, List<String>> headers)
    • newShortSessionId

      public static String newShortSessionId()