Package discord4j.gateway
Interface GatewayClientGroup
public interface GatewayClientGroup
An aggregation for arbitrary group of
GatewayClient
instances.-
Method Summary
Modifier and TypeMethodDescriptiondefault int
computeShardIndex
(Snowflake guildId) Return the shard index according to the shard count given by thisGatewayClientGroup
.find
(int shardIndex) Return aGatewayClient
given by ashardIndex
, if present.int
Return the current value of theshardCount
parameter.logout()
Instructs that on subscription this group should log out from Discord Gateway.multicast
(GatewayPayload<?> payload) Send a singleGatewayPayload
to allGatewayClient
instances represented by this group and returns aMono
that signals completion when it has been sent.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 Details
-
find
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
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
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
Instructs that on subscription this group should log out from Discord Gateway. -
computeShardIndex
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
-