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
Modifier and TypeFieldDescriptionstatic final ConnectionObserver.State
Propagated when a gateway connection has been established.static final ConnectionObserver.State
Propagated when a gateway connection has been fully closed.static final ConnectionObserver.State
Propagated when a gateway connection has been closed but is still open for a RESUME attempt.static final GatewayObserver
static final ConnectionObserver.State
Propagated when a reconnection attempt has failed.static final ConnectionObserver.State
Propagated when a reconnection attempt with RESUME has started.static final ConnectionObserver.State
Propagated when a reconnection attempt with IDENTIFY has started.static final ConnectionObserver.State
Propagated when a reconnection attempt has succeeded.static final ConnectionObserver.State
Propagated when the current session sequence value has updated. -
Method Summary
Modifier and TypeMethodDescriptionstatic GatewayObserver
void
onStateChange
(ConnectionObserver.State newState, GatewayClient client) React on websocket state change.default GatewayObserver
then
(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
-