Interface ITwitchPubSub

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
TwitchPubSub, TwitchPubSubConnectionPool

public interface ITwitchPubSub extends AutoCloseable
  • Method Details

    • getEventManager

      com.github.philippheuer.events4j.core.EventManager getEventManager()
    • listenOnTopic

      PubSubSubscription listenOnTopic(PubSubRequest request)
      Send WS Message to subscribe to a topic
      Parameters:
      request - Topic
      Returns:
      PubSubSubscription to be listened to
    • unsubscribeFromTopic

      boolean unsubscribeFromTopic(PubSubSubscription subscription)
      Unsubscribe from a topic. Usage example:
            PubSubSubscription subscription = twitchPubSub.listenForCheerEvents(...);
            // ...
            twitchPubSub.unsubscribeFromTopic(subscription);
       
      Parameters:
      subscription - PubSubSubscription to be unlistened from
      Returns:
      whether the subscription was previously subscribed to
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
    • listenOnTopic

      default PubSubSubscription listenOnTopic(PubSubType type, com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, Collection<String> topics)
    • listenOnTopic

      default PubSubSubscription listenOnTopic(PubSubType type, com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String topic)
    • listenOnTopic

      default PubSubSubscription listenOnTopic(PubSubType type, com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String... topics)
    • listenForAutomodQueueEvents

      default PubSubSubscription listenForAutomodQueueEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
      Event Listener: AutoMod flags a message as potentially inappropriate, and when a moderator takes action on a message.
      Parameters:
      credential - Credential (for userId, scope: channel:moderate)
      userId - The moderator's user id associated with the credential
      channelId - The user id associated with the target channel
      Returns:
      PubSubSubscription
    • listenForBitsBadgeEvents

      default PubSubSubscription listenForBitsBadgeEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Event Listener: User earned a new Bits badge and shared the notification with chat
      Parameters:
      credential - Credential (for target channel id, scope: bits:read)
      channelId - Target Channel Id
      Returns:
      PubSubSubscription
    • listenForCheerEvents

      default PubSubSubscription listenForCheerEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Event Listener: Anyone cheers on a specified channel.
      Parameters:
      credential - Credential (for target channel id, scope: bits:read)
      channelId - Target Channel Id
      Returns:
      PubSubSubscription
    • listenForSubscriptionEvents

      default PubSubSubscription listenForSubscriptionEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Event Listener: Anyone subscribes (first month), resubscribes (subsequent months), or gifts a subscription to a channel.
      Parameters:
      credential - Credential (for targetChannelId, scope: channel_subscriptions)
      channelId - Target Channel Id
      Returns:
      PubSubSubscription
    • listenForCommerceEvents

      @Deprecated default PubSubSubscription listenForCommerceEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
      Event Listener: Anyone makes a purchase on a channel.
      Parameters:
      credential - Credential (any)
      channelId - Target Channel Id
      Returns:
      PubSubSubscription
    • listenForWhisperEvents

      default PubSubSubscription listenForWhisperEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Event Listener: Anyone whispers the specified user.
      Parameters:
      credential - Credential (for targetUserId, scope: whispers:read)
      userId - Target User Id
      Returns:
      PubSubSubscription
    • listenForLowTrustUsersEvents

      default PubSubSubscription listenForLowTrustUsersEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
      Event Listener: Suspicious user events.

      This includes when a chatter's treatment status changes (e.g., monitored or restricted), and when a treated user sends a chat message.

      Parameters:
      credential - Moderator's user access token (scope: channel:moderate) associated with the specified user id.
      userId - The user id of the moderator.
      channelId - The channel id to monitor events from.
      Returns:
      PubSubSubscription
      See Also:
    • listenForModerationEvents

      @Deprecated @Unofficial default PubSubSubscription listenForModerationEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
      in favor of listenForModerationEvents(OAuth2Credential, String, String)
      Event Listener: A moderator performs an action in the channel
      Parameters:
      credential - Credential (for channelId, scope: channel:moderate)
      channelId - Target Channel Id
      Returns:
      PubSubSubscription
    • listenForModerationEvents

      default PubSubSubscription listenForModerationEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
      Event Listener: A moderator performs an action in the channel
      Parameters:
      credential - Credential (for userId, scope: channel:moderate)
      userId - The user id associated with the credential
      channelId - The user id associated with the target channel
      Returns:
      PubSubSubscription
    • listenForUserModerationNotificationEvents

      default PubSubSubscription listenForUserModerationNotificationEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
      Event Listener: A user’s message held by AutoMod has been approved or denied.
      Parameters:
      credential - Credential (for userId, scope: chat:read)
      userId - The user id associated with the credential
      channelId - The user id associated with the target channel
      Returns:
      PubSubSubscription
    • listenForChannelPointsRedemptionEvents

      default PubSubSubscription listenForChannelPointsRedemptionEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Event Listener: Anyone makes a channel points redemption on a channel.
      Parameters:
      credential - Credential (with the channel:read:redemptions scope for maximum information)
      channelId - Target Channel Id
      Returns:
      PubSubSubscription
    • listenForAdsEvents

      @Unofficial default PubSubSubscription listenForAdsEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForAdsManagerEvents

      @Unofficial default PubSubSubscription listenForAdsManagerEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
    • listenForAdPropertyRefreshEvents

      @Unofficial @Deprecated default PubSubSubscription listenForAdPropertyRefreshEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForAutomodLevelsModificationEvents

      @Unofficial default PubSubSubscription listenForAutomodLevelsModificationEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
    • listenForBountyBoardEvents

      @Unofficial @Deprecated default PubSubSubscription listenForBountyBoardEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForDashboardActivityFeedEvents

      @Unofficial @Deprecated default PubSubSubscription listenForDashboardActivityFeedEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Deprecated.
    • listenForCommunityBoostEvents

      @Unofficial default PubSubSubscription listenForCommunityBoostEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForCreatorGoalsEvents

      @Unofficial default PubSubSubscription listenForCreatorGoalsEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForCrowdChantEvents

      @Unofficial @Deprecated default PubSubSubscription listenForCrowdChantEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
      the crowd chant experiment was disabled by Twitch on 2022-02-02
      Parameters:
      credential - OAuth2Credential
      channelId - channel id
      Returns:
      PubSubSubscription
    • listenForUserChannelPointsEvents

      @Unofficial default PubSubSubscription listenForUserChannelPointsEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
    • listenForChannelDropEvents

      @Unofficial @Deprecated default PubSubSubscription listenForChannelDropEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForChannelBitsLeaderboardEvents

      @Unofficial default PubSubSubscription listenForChannelBitsLeaderboardEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForChannelBitsLeaderboardMonthlyEvents

      @Unofficial default PubSubSubscription listenForChannelBitsLeaderboardMonthlyEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForChannelBitsLeaderboardAllTimeEvents

      @Unofficial default PubSubSubscription listenForChannelBitsLeaderboardAllTimeEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForChannelBitsLeaderboardEvents

      @Unofficial default PubSubSubscription listenForChannelBitsLeaderboardEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId, String timeAggregationUnit)
    • listenForChannelPrimeGiftStatusEvents

      @Unofficial @Deprecated default PubSubSubscription listenForChannelPrimeGiftStatusEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForChannelSubLeaderboardEvents

      @Unofficial default PubSubSubscription listenForChannelSubLeaderboardEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForChannelSubLeaderboardMonthlyEvents

      @Unofficial default PubSubSubscription listenForChannelSubLeaderboardMonthlyEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForChannelSubLeaderboardAllTimeEvents

      @Unofficial default PubSubSubscription listenForChannelSubLeaderboardAllTimeEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForChannelSubLeaderboardEvents

      @Unofficial default PubSubSubscription listenForChannelSubLeaderboardEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId, String timeAggregationUnit)
    • listenForLeaderboardEvents

      @Unofficial default PubSubSubscription listenForLeaderboardEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForLeaderboardMonthlyEvents

      @Unofficial default PubSubSubscription listenForLeaderboardMonthlyEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForLeaderboardAllTimeEvents

      @Unofficial default PubSubSubscription listenForLeaderboardAllTimeEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForLeaderboardEvents

      @Unofficial default PubSubSubscription listenForLeaderboardEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId, String timeAggregationUnit)
    • listenForPinnedChatEvents

      @Unofficial default PubSubSubscription listenForPinnedChatEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForChannelPredictionsEvents

      @Unofficial default PubSubSubscription listenForChannelPredictionsEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForUserPredictionsEvents

      @Unofficial default PubSubSubscription listenForUserPredictionsEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
    • listenForChannelSubGiftsEvents

      @Unofficial default PubSubSubscription listenForChannelSubGiftsEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForChannelSquadEvents

      @Unofficial @Deprecated default PubSubSubscription listenForChannelSquadEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForRaidEvents

      @Unofficial default PubSubSubscription listenForRaidEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForChannelUnbanRequestEvents

      @Unofficial default PubSubSubscription listenForChannelUnbanRequestEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
    • listenForUserUnbanRequestEvents

      @Unofficial default PubSubSubscription listenForUserUnbanRequestEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
    • listenForChannelExtensionEvents

      @Unofficial @Deprecated default PubSubSubscription listenForChannelExtensionEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForCharityCampaignEvents

      @Unofficial default PubSubSubscription listenForCharityCampaignEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForExtensionControlEvents

      @Unofficial @Deprecated default PubSubSubscription listenForExtensionControlEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForHypeTrainEvents

      @Unofficial default PubSubSubscription listenForHypeTrainEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForHypeTrainRewardEvents

      @Unofficial @Deprecated @ScheduledForRemoval(inVersion="2.0.0") default PubSubSubscription listenForHypeTrainRewardEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForBroadcastSettingUpdateEvents

      @Unofficial default PubSubSubscription listenForBroadcastSettingUpdateEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForCelebrationEvents

      @Unofficial @Deprecated default PubSubSubscription listenForCelebrationEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForPublicBitEvents

      @Unofficial @Deprecated default PubSubSubscription listenForPublicBitEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForChatHighlightEvents

      @Unofficial default PubSubSubscription listenForChatHighlightEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
    • listenForPublicCheerEvents

      @Unofficial default PubSubSubscription listenForPublicCheerEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForStreamChangeEvents

      @Unofficial @Deprecated default PubSubSubscription listenForStreamChangeEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForStreamChatRoomEvents

      @Unofficial @Deprecated default PubSubSubscription listenForStreamChatRoomEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForChannelChatroomEvents

      @Unofficial @Deprecated default PubSubSubscription listenForChannelChatroomEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • listenForUserChatroomEvents

      @Unofficial default PubSubSubscription listenForUserChatroomEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
    • listenForUserBitsUpdateEvents

      @Unofficial @Deprecated default PubSubSubscription listenForUserBitsUpdateEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Deprecated.
    • listenForUserCampaignEvents

      @Unofficial @Deprecated default PubSubSubscription listenForUserCampaignEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Deprecated.
    • listenForUserDropEvents

      @Unofficial @Deprecated default PubSubSubscription listenForUserDropEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Deprecated.
    • listenForUserPropertiesUpdateEvents

      @Unofficial @Deprecated default PubSubSubscription listenForUserPropertiesUpdateEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Deprecated.
    • listenForUserSubscribeEvents

      @Unofficial @Deprecated default PubSubSubscription listenForUserSubscribeEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Deprecated.
    • listenForUserImageUpdateEvents

      @Unofficial @Deprecated default PubSubSubscription listenForUserImageUpdateEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Deprecated.
    • listenForFollowingEvents

      @Unofficial @Deprecated default PubSubSubscription listenForFollowingEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
      Twitch has silently disabled this topic, even for first-party moderator tokens. You should migrate to eventsub (websocket) channel.follow v2 subscription type.
      Event Listener: Anyone follows the specified channel.
      Parameters:
      credential - OAuth2Credential
      channelId - the id for the channel
      Returns:
      PubSubSubscription
    • listenForFriendshipEvents

      @Unofficial @Deprecated default PubSubSubscription listenForFriendshipEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Deprecated.
      Friends are being removed by Twitch on 2022-05-25
      Parameters:
      credential - user access token
      userId - user id associated with the token
      Returns:
      PubSubSubscription
    • listenForOnsiteNotificationEvents

      @Unofficial default PubSubSubscription listenForOnsiteNotificationEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
    • listenForPollEvents

      @Unofficial default PubSubSubscription listenForPollEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForPresenceEvents

      @Unofficial @Deprecated default PubSubSubscription listenForPresenceEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId)
      Deprecated.
      Friends are being removed by Twitch on 2022-05-25
      Parameters:
      credential - user access token
      userId - user id associated with the token
      Returns:
      PubSubSubscription
    • listenForRadioEvents

      @Unofficial @Deprecated @ScheduledForRemoval default PubSubSubscription listenForRadioEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Unofficial: Listen for soundtrack events
      Parameters:
      credential - User Access Token
      channelId - Target Channel Id
      Returns:
      PubSubSubscription
    • listenForShieldModeEvents

      @Unofficial default PubSubSubscription listenForShieldModeEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String userId, String channelId)
    • listenForShoutoutEvents

      @Unofficial default PubSubSubscription listenForShoutoutEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForVideoPlaybackEvents

      @Unofficial default PubSubSubscription listenForVideoPlaybackEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
    • listenForVideoPlaybackByNameEvents

      @Unofficial default PubSubSubscription listenForVideoPlaybackByNameEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelName)
    • listenForWatchPartyEvents

      @Unofficial @Deprecated default PubSubSubscription listenForWatchPartyEvents(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential, String channelId)
      Deprecated.
    • getLatency

      long getLatency()
      Returns:
      the most recently measured round-trip latency for the socket(s) in milliseconds, or -1 if unknown