Package discord4j.gateway
Interface GatewayClientGroup
-
public interface GatewayClientGroup
An aggregation for arbitrary group ofGatewayClient
instances.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
computeShardIndex(Snowflake guildId)
Return the shard index according to the shard count given by thisGatewayClientGroup
.Optional<GatewayClient>
find(int shardIndex)
Return aGatewayClient
given by ashardIndex
, if present.int
getShardCount()
Return the current value of theshardCount
parameter.Mono<Void>
logout()
Instructs that on subscription this group should log out from Discord Gateway.Mono<Void>
multicast(GatewayPayload<?> payload)
Send a singleGatewayPayload
to allGatewayClient
instances represented by this group and returns aMono
that signals completion when it has been sent.Mono<Void>
unicast(ShardGatewayPayload<?> payload)
Send a singleShardGatewayPayload
to a specificGatewayClient
instance, given by the routing information inShardGatewayPayload.getShardIndex()
and returns aMono
that signals completion when it has been sent.
-
-
-
Method Detail
-
find
Optional<GatewayClient> find(int shardIndex)
Return aGatewayClient
given by ashardIndex
, if present.- Parameters:
shardIndex
- a shard index to locate a particular client- Returns:
- a
GatewayClient
for a shard index, if present
-
getShardCount
int getShardCount()
Return the current value of theshardCount
parameter.- Returns:
- the current shard count
-
multicast
Mono<Void> multicast(GatewayPayload<?> payload)
Send a singleGatewayPayload
to allGatewayClient
instances represented by this group and returns aMono
that signals completion when it has been sent.- Parameters:
payload
- a single outbound payload- Returns:
- a
Mono
completing when the payload is sent
-
unicast
Mono<Void> unicast(ShardGatewayPayload<?> payload)
Send a singleShardGatewayPayload
to a specificGatewayClient
instance, given by the routing information inShardGatewayPayload.getShardIndex()
and returns aMono
that signals completion when it has been sent.- Parameters:
payload
- a single outbound payload- Returns:
- a
Mono
completing 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
-
-