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.
Event listeners for gateway connection lifecycle.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConnectionObserver.StatePropagated when a gateway connection has been established.static final ConnectionObserver.StatePropagated when a gateway connection has been fully closed.static final ConnectionObserver.StatePropagated when a gateway connection has been closed but is still open for a RESUME attempt.static final GatewayObserverstatic final ConnectionObserver.StatePropagated when a reconnection attempt has failed.static final ConnectionObserver.StatePropagated when a reconnection attempt with RESUME has started.static final ConnectionObserver.StatePropagated when a reconnection attempt with IDENTIFY has started.static final ConnectionObserver.StatePropagated when a reconnection attempt has succeeded.static final ConnectionObserver.StatePropagated when the current session sequence value has updated. -
Method Summary
Modifier and TypeMethodDescriptionstatic GatewayObservervoidonStateChange(ConnectionObserver.State newState, GatewayClient client) React on websocket state change.default GatewayObserverthen(GatewayObserver other) Chain together anotherGatewayObserver.
-
Field Details
-
NOOP_LISTENER
-
CONNECTED
Propagated when a gateway connection has been established. -
DISCONNECTED
Propagated when a gateway connection has been fully closed. -
DISCONNECTED_RESUME
Propagated when a gateway connection has been closed but is still open for a RESUME attempt. -
RETRY_RESUME_STARTED
Propagated when a reconnection attempt with RESUME has started. -
RETRY_STARTED
Propagated when a reconnection attempt with IDENTIFY has started. -
RETRY_SUCCEEDED
Propagated when a reconnection attempt has succeeded. -
RETRY_FAILED
Propagated when a reconnection attempt has failed. -
SEQUENCE
Propagated when the current session sequence value has updated.
-
-
Method Details
-
emptyListener
-
onStateChange
React on websocket state change.- Parameters:
newState- the new stateclient- the gateway client observing this change
-
then
Chain together anotherGatewayObserver.- Parameters:
other- the nextGatewayObserver- Returns:
- a new composite
GatewayObserver
-