Enum Class ConnectionState

java.lang.Object
java.lang.Enum<ConnectionState>
dev.objz.commandbridge.api.platform.ConnectionState
All Implemented Interfaces:
Serializable, Comparable<ConnectionState>, Constable

public enum ConnectionState extends Enum<ConnectionState>
Represents the network connection status between a server and the CommandBridge network.

A server progresses through states in the following normal lifecycle: it begins in DISCONNECTED, advances to CONNECTING while the socket is being established, then to CONNECTED once the socket is open (but before authentication completes), and finally to AUTHENTICATED when the server is fully operational and ready to exchange messages. If the connection drops unexpectedly from AUTHENTICATED or CONNECTED, the state transitions to RECONNECTING and the client attempts to re-establish the connection. If authentication fails at any point, the state becomes AUTH_FAILED and no further connection attempts are made.

See Also:
  • Enum Constant Details

    • DISCONNECTED

      public static final ConnectionState DISCONNECTED
      No connection has been established.

      This is the initial state before any connection attempt has been made.

    • CONNECTING

      public static final ConnectionState CONNECTING
      A socket connection is being established.

      This state precedes CONNECTED and indicates that the client is actively attempting to open a socket to the bridge network.

    • CONNECTED

      public static final ConnectionState CONNECTED
      The socket connection is established; awaiting authentication.

      This is an intermediate state. The socket is open but the handshake has not yet completed, so messages cannot be sent or received until the state advances to AUTHENTICATED.

    • AUTHENTICATED

      public static final ConnectionState AUTHENTICATED
      Fully connected and authenticated; messages may be sent and received.

      This is the only state in which isActive() returns true. All message channels are operational while the server remains in this state.

    • RECONNECTING

      public static final ConnectionState RECONNECTING
      The connection was lost and a reconnection attempt is in progress.

      This state occurs after an unexpected disconnect from AUTHENTICATED or CONNECTED. The client will attempt to re-establish the connection and progress back through CONNECTING and CONNECTED.

    • AUTH_FAILED

      public static final ConnectionState AUTH_FAILED
      Authentication failed; no further connection attempts will be made.

      If the server reaches this state, verify that the configured secret key matches on both the Velocity proxy and the backend server.

  • Method Details

    • values

      public static ConnectionState[] 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 ConnectionState 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
    • isActive

      public boolean isActive()
      Returns whether the connection is established and ready for message transport.
      Returns:
      true if and only if the current state is AUTHENTICATED, false otherwise