Interface GatewayClientGroup


public interface GatewayClientGroup
An aggregation for arbitrary group of GatewayClient instances.
  • Method Details

    • find

      Optional<GatewayClient> find(int shardIndex)
      Return a GatewayClient given by a shardIndex, 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 the shardCount parameter.
      Returns:
      the current shard count
    • multicast

      Mono<Void> multicast(GatewayPayload<?> payload)
      Send a single GatewayPayload to all GatewayClient instances represented by this group and returns a Mono 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 single ShardGatewayPayload to a specific GatewayClient instance, given by the routing information in ShardGatewayPayload.getShardIndex() and returns a Mono 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.
      Returns:
      a Mono indicating completion when the logout has succeeded. If an error occurs it is forwarded through this Mono.
    • computeShardIndex

      default int computeShardIndex(Snowflake guildId)
      Return the shard index according to the shard count given by this GatewayClientGroup.
      Parameters:
      guildId - the input guild ID to compute the shard index
      Returns:
      the shard index for a given guild ID