Enum WebSocketFrameType

java.lang.Object
java.lang.Enum<WebSocketFrameType>
io.vertx.ext.stomp.WebSocketFrameType
All Implemented Interfaces:
Serializable, Comparable<WebSocketFrameType>

public enum WebSocketFrameType extends Enum<WebSocketFrameType>
Defines the type of WebSocket frames to use when sending STOMP messages over WebSocket.

This configuration allows choosing between text and binary WebSocket frames for STOMP message transmission. The choice affects compatibility with different STOMP clients:

  • TEXT - Uses text WebSocket frames. Compatible with JavaScript STOMP clients (e.g. StompJS). This is the recommended default for most use cases as STOMP is a text-based protocol.
  • BINARY - Uses binary WebSocket frames. This was the legacy behavior and may be needed for backward compatibility with existing applications that expect binary frames.
Author:
Clement Escoffier
  • Enum Constant Details

    • TEXT

      public static final WebSocketFrameType TEXT
      Use text WebSocket frames for STOMP messages.

      This is the recommended option for maximum compatibility with JavaScript STOMP clients and aligns with STOMP being a text-oriented protocol.

      Note: When using text frames, STOMP message bodies containing binary data must be UTF-8 safe or should be Base64 encoded at the application level.

    • BINARY

      public static final WebSocketFrameType BINARY
      Use binary WebSocket frames for STOMP messages.

      This was the legacy behavior in earlier versions. It handles any content (text or binary) but may not be compatible with some JavaScript STOMP clients that expect text frames.

      Use this option for backward compatibility with existing applications.

  • Method Details

    • values

      public static WebSocketFrameType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static WebSocketFrameType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null