Class ConduitSpec

java.lang.Object
com.github.twitch4j.eventsub.socket.conduit.ConduitSpec

public final class ConduitSpec extends Object
  • Method Details

    • validate

      public void validate()
    • process

      @NotNull public static @NotNull ConduitSpec process(@NotNull @NotNull Consumer<ConduitSpec> spec)
    • conduitId

      @Nullable public @Nullable String conduitId()
      The ID of an already created Conduit (optional); otherwise TwitchConduitSocketPool will create a new Conduit.
    • poolShards

      public int poolShards()
      The number of websockets that should be created by the TwitchConduitSocketPool instance.

      Must be positive.

    • totalShardCount

      @Nullable public @Nullable Integer totalShardCount()
      The total number of shards associated with the Conduit ID (optional).

      If the Conduit is already created, specifying this value avoids a TwitchHelix.getConduits(String) call.

      If the Conduit is not created yet, this field can be used to create a larger Conduit than poolShards() (if you plan to create another TwitchConduitSocketPool instance on another server).

    • shardOffset

      public int shardOffset()
      An integer offset for the Shard IDs to be registered with the Conduit.

      This field should only be set if the Conduit is already created with some shards already registered.

    • clientId

      @Nullable public @Nullable String clientId()
      Your application's client ID.

      Not required if appAccessToken() is specified or helix() already has client credentials.

    • clientSecret

      @Nullable public @Nullable String clientSecret()
      Your application's client secret.

      Not required if appAccessToken() is specified or helix() already has client credentials.

    • helix

      @Nullable public @Nullable TwitchHelix helix()
      An optional TwitchHelix instance (if one is already created).
    • appAccessToken

      @Nullable public @Nullable com.github.philippheuer.credentialmanager.domain.OAuth2Credential appAccessToken()
      The app access token for helix requests.

      Not required if client id and secret are specified OR the specified helix instance already has client credentials.

    • executor

      @Nullable public @Nullable ScheduledThreadPoolExecutor executor()
    • eventManager

      @Nullable public @Nullable com.github.philippheuer.events4j.core.EventManager eventManager()
      An optional EventManager (if one is already created).

      Prefer using IEventSubConduit.getEventManager() (instead of creating an EventManager).

    • proxyConfig

      @Nullable public @Nullable ProxyConfig proxyConfig()
      Optional: the proxy to use for helix requests and the websocket connections.
    • socketWelcomeTimeout

      @Nullable public @Nullable Duration socketWelcomeTimeout()
      The amount of time to wait for the websocket shards to be welcomed by Twitch.

      If a shard does not connect within this timeout, ShardTimeoutException is thrown by TwitchConduitSocketPool.

    • conduitId

      public ConduitSpec conduitId(@Nullable @Nullable String conduitId)
      The ID of an already created Conduit (optional); otherwise TwitchConduitSocketPool will create a new Conduit.
      Returns:
      this.
    • poolShards

      public ConduitSpec poolShards(int poolShards)
      The number of websockets that should be created by the TwitchConduitSocketPool instance.

      Must be positive.

      Returns:
      this.
    • totalShardCount

      public ConduitSpec totalShardCount(@Nullable @Nullable Integer totalShardCount)
      The total number of shards associated with the Conduit ID (optional).

      If the Conduit is already created, specifying this value avoids a TwitchHelix.getConduits(String) call.

      If the Conduit is not created yet, this field can be used to create a larger Conduit than poolShards() (if you plan to create another TwitchConduitSocketPool instance on another server).

      Returns:
      this.
    • shardOffset

      public ConduitSpec shardOffset(int shardOffset)
      An integer offset for the Shard IDs to be registered with the Conduit.

      This field should only be set if the Conduit is already created with some shards already registered.

      Returns:
      this.
    • clientId

      public ConduitSpec clientId(@Nullable @Nullable String clientId)
      Your application's client ID.

      Not required if appAccessToken() is specified or helix() already has client credentials.

      Returns:
      this.
    • clientSecret

      public ConduitSpec clientSecret(@Nullable @Nullable String clientSecret)
      Your application's client secret.

      Not required if appAccessToken() is specified or helix() already has client credentials.

      Returns:
      this.
    • helix

      public ConduitSpec helix(@Nullable @Nullable TwitchHelix helix)
      An optional TwitchHelix instance (if one is already created).
      Returns:
      this.
    • appAccessToken

      public ConduitSpec appAccessToken(@Nullable @Nullable com.github.philippheuer.credentialmanager.domain.OAuth2Credential appAccessToken)
      The app access token for helix requests.

      Not required if client id and secret are specified OR the specified helix instance already has client credentials.

      Returns:
      this.
    • executor

      public ConduitSpec executor(@Nullable @Nullable ScheduledThreadPoolExecutor executor)
      Returns:
      this.
    • eventManager

      public ConduitSpec eventManager(@Nullable @Nullable com.github.philippheuer.events4j.core.EventManager eventManager)
      An optional EventManager (if one is already created).

      Prefer using IEventSubConduit.getEventManager() (instead of creating an EventManager).

      Returns:
      this.
    • proxyConfig

      public ConduitSpec proxyConfig(@Nullable @Nullable ProxyConfig proxyConfig)
      Optional: the proxy to use for helix requests and the websocket connections.
      Returns:
      this.
    • socketWelcomeTimeout

      public ConduitSpec socketWelcomeTimeout(@Nullable @Nullable Duration socketWelcomeTimeout)
      The amount of time to wait for the websocket shards to be welcomed by Twitch.

      If a shard does not connect within this timeout, ShardTimeoutException is thrown by TwitchConduitSocketPool.

      Returns:
      this.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object