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