Package discord4j.gateway
Interface GatewayObserver
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface GatewayObserver
Event listeners for gateway connection lifecycle.
-
-
Field Summary
Fields Modifier and Type Field Description static ConnectionObserver.StateCONNECTEDPropagated when a gateway connection has been established.static ConnectionObserver.StateDISCONNECTEDPropagated when a gateway connection has been fully closed.static ConnectionObserver.StateDISCONNECTED_RESUMEPropagated when a gateway connection has been closed but is still open for a RESUME attempt.static GatewayObserverNOOP_LISTENERstatic ConnectionObserver.StateRETRY_FAILEDPropagated when a reconnection attempt has failed.static ConnectionObserver.StateRETRY_RESUME_STARTEDPropagated when a reconnection attempt with RESUME has started.static ConnectionObserver.StateRETRY_STARTEDPropagated when a reconnection attempt with IDENTIFY has started.static ConnectionObserver.StateRETRY_SUCCEEDEDPropagated when a reconnection attempt has succeeded.static ConnectionObserver.StateSEQUENCEPropagated when the current session sequence value has updated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static GatewayObserveremptyListener()voidonStateChange(ConnectionObserver.State newState, GatewayClient client)React on websocket state change.default GatewayObserverthen(GatewayObserver other)Chain together anotherGatewayObserver.
-
-
-
Field Detail
-
NOOP_LISTENER
static final GatewayObserver NOOP_LISTENER
-
CONNECTED
static final ConnectionObserver.State CONNECTED
Propagated when a gateway connection has been established.
-
DISCONNECTED
static final ConnectionObserver.State DISCONNECTED
Propagated when a gateway connection has been fully closed.
-
DISCONNECTED_RESUME
static final ConnectionObserver.State DISCONNECTED_RESUME
Propagated when a gateway connection has been closed but is still open for a RESUME attempt.
-
RETRY_RESUME_STARTED
static final ConnectionObserver.State RETRY_RESUME_STARTED
Propagated when a reconnection attempt with RESUME has started.
-
RETRY_STARTED
static final ConnectionObserver.State RETRY_STARTED
Propagated when a reconnection attempt with IDENTIFY has started.
-
RETRY_SUCCEEDED
static final ConnectionObserver.State RETRY_SUCCEEDED
Propagated when a reconnection attempt has succeeded.
-
RETRY_FAILED
static final ConnectionObserver.State RETRY_FAILED
Propagated when a reconnection attempt has failed.
-
SEQUENCE
static final ConnectionObserver.State SEQUENCE
Propagated when the current session sequence value has updated.
-
-
Method Detail
-
emptyListener
static GatewayObserver emptyListener()
-
onStateChange
void onStateChange(ConnectionObserver.State newState, GatewayClient client)
React on websocket state change.- Parameters:
newState- the new stateclient- the gateway client observing this change
-
then
default GatewayObserver then(GatewayObserver other)
Chain together anotherGatewayObserver.- Parameters:
other- the nextGatewayObserver- Returns:
- a new composite
GatewayObserver
-
-