Package discord4j.gateway
Interface GatewayClientGroup
-
public interface GatewayClientGroupAn aggregation for arbitrary group ofGatewayClientinstances.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default intcomputeShardIndex(Snowflake guildId)Return the shard index according to the shard count given by thisGatewayClientGroup.Optional<GatewayClient>find(int shardIndex)Return aGatewayClientgiven by ashardIndex, if present.intgetShardCount()Return the current value of theshardCountparameter.Mono<Void>logout()Instructs that on subscription this group should log out from Discord Gateway.Mono<Void>multicast(GatewayPayload<?> payload)Send a singleGatewayPayloadto allGatewayClientinstances represented by this group and returns aMonothat signals completion when it has been sent.Mono<Void>unicast(ShardGatewayPayload<?> payload)Send a singleShardGatewayPayloadto a specificGatewayClientinstance, given by the routing information inShardGatewayPayload.getShardIndex()and returns aMonothat signals completion when it has been sent.
-
-
-
Method Detail
-
find
Optional<GatewayClient> find(int shardIndex)
Return aGatewayClientgiven by ashardIndex, if present.- Parameters:
shardIndex- a shard index to locate a particular client- Returns:
- a
GatewayClientfor a shard index, if present
-
getShardCount
int getShardCount()
Return the current value of theshardCountparameter.- Returns:
- the current shard count
-
multicast
Mono<Void> multicast(GatewayPayload<?> payload)
Send a singleGatewayPayloadto allGatewayClientinstances represented by this group and returns aMonothat signals completion when it has been sent.- Parameters:
payload- a single outbound payload- Returns:
- a
Monocompleting when the payload is sent
-
unicast
Mono<Void> unicast(ShardGatewayPayload<?> payload)
Send a singleShardGatewayPayloadto a specificGatewayClientinstance, given by the routing information inShardGatewayPayload.getShardIndex()and returns aMonothat signals completion when it has been sent.- Parameters:
payload- a single outbound payload- Returns:
- a
Monocompleting when the payload is sent
-
logout
Mono<Void> logout()
Instructs that on subscription this group should log out from Discord Gateway.
-
computeShardIndex
default int computeShardIndex(Snowflake guildId)
Return the shard index according to the shard count given by thisGatewayClientGroup.- Parameters:
guildId- the input guild ID to compute the shard index- Returns:
- the shard index for a given guild ID
-
-