Enum Class SSEEvent

java.lang.Object
java.lang.Enum<SSEEvent>
com.ns.tcpframework.reqeustHandlers.sse.SSEEvent
All Implemented Interfaces:
Serializable, Comparable<SSEEvent>, Constable

public enum SSEEvent extends Enum<SSEEvent>
Enumeration representing different types of Server-Sent Events (SSE) that can be broadcast to clients.

This enum defines the event types used in the SSE communication protocol between the server and connected clients. Each event type serves a specific purpose in the real-time communication system.

  • Enum Constant Details

    • LOG

      public static final SSEEvent LOG
      Log event - Used to send server log messages to connected clients.

      This event type is triggered when the server wants to broadcast log information to client dashboards or monitoring interfaces.

    • STATS

      public static final SSEEvent STATS
      Stats event - Used to send server statistics and performance metrics to clients.

      This event type carries server metrics such as CPU usage, memory usage, uptime, total requests, and active connections.

    • CONNECTED

      public static final SSEEvent CONNECTED
      Connected event - Used to notify a client that the SSE connection has been established.

      This event type is typically sent immediately after a client connects to confirm the successful establishment of the SSE stream.

    • HEARTBEAT

      public static final SSEEvent HEARTBEAT
      Heartbeat event - Used to keep the SSE connection alive.

      This event type is sent periodically to prevent connection timeouts and to verify that the connection is still active. Clients can use this to detect disconnections.

  • Method Details

    • values

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

      public static SSEEvent valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null