Package com.github.twitch4j.pubsub
Klasse TwitchPubSub
java.lang.Object
com.github.twitch4j.pubsub.TwitchPubSub
- Alle implementierten Schnittstellen:
ITwitchPubSub,AutoCloseable
Twitch PubSub
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected final BlockingQueue<String> Command Queueprotected final Future<?> Heartbeat Threadprotected booleanis Closed?protected longLast Ping send (1 minute delay before sending the first ping)protected longLast Pong receivedprotected final Future<?> Command Queue Threadstatic final intprotected final Set<PubSubRequest> Holds the subscribed topics in case we need to reconnectprotected final ScheduledExecutorServiceThread Pool Executor -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungTwitchPubSub(WebsocketConnection websocketConnection, EventManager eventManager, ScheduledThreadPoolExecutor taskExecutor, ProxyConfig proxyConfig, Collection<String> botOwnerIds, int wsPingPeriod, IBackoffStrategy connectionBackoffStrategy, int wsCloseDelay, Consumer<PubSubResponsePayload> fallbackTopicHandler) Constructor -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidclose()Closevoidconnect()Connecting to IRC-WSvoidDisconnecting from WebSocketEventManagerlonglistenOnTopic(PubSubRequest request) Send WS Message to subscribe to a topicprotected voidprotected voidprotected voidonTextMessage(String text) voidReconnecting to WebSocketbooleanunsubscribeFromTopic(PubSubSubscription subscription) Unsubscribe from a topic.Von Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitVon Schnittstelle geerbte Methoden com.github.twitch4j.pubsub.ITwitchPubSub
listenForAdPropertyRefreshEvents, listenForAdsEvents, listenForAdsManagerEvents, listenForAutomodLevelsModificationEvents, listenForAutomodQueueEvents, listenForBitsBadgeEvents, listenForBountyBoardEvents, listenForBroadcastSettingUpdateEvents, listenForCelebrationEvents, listenForChannelBitsLeaderboardAllTimeEvents, listenForChannelBitsLeaderboardEvents, listenForChannelBitsLeaderboardEvents, listenForChannelBitsLeaderboardMonthlyEvents, listenForChannelChatroomEvents, listenForChannelDropEvents, listenForChannelExtensionEvents, listenForChannelPointsRedemptionEvents, listenForChannelPredictionsEvents, listenForChannelPrimeGiftStatusEvents, listenForChannelSquadEvents, listenForChannelSubGiftsEvents, listenForChannelSubLeaderboardAllTimeEvents, listenForChannelSubLeaderboardEvents, listenForChannelSubLeaderboardEvents, listenForChannelSubLeaderboardMonthlyEvents, listenForChannelUnbanRequestEvents, listenForCharityCampaignEvents, listenForChatHighlightEvents, listenForCheerEvents, listenForCommerceEvents, listenForCommunityBoostEvents, listenForCreatorGoalsEvents, listenForCrowdChantEvents, listenForDashboardActivityFeedEvents, listenForExtensionControlEvents, listenForFollowingEvents, listenForFriendshipEvents, listenForHypeTrainEvents, listenForHypeTrainRewardEvents, listenForLeaderboardAllTimeEvents, listenForLeaderboardEvents, listenForLeaderboardEvents, listenForLeaderboardMonthlyEvents, listenForLowTrustUsersEvents, listenForModerationEvents, listenForModerationEvents, listenForOnsiteNotificationEvents, listenForPinnedChatEvents, listenForPollEvents, listenForPresenceEvents, listenForPublicBitEvents, listenForPublicCheerEvents, listenForRadioEvents, listenForRaidEvents, listenForShieldModeEvents, listenForShoutoutEvents, listenForStreamChangeEvents, listenForStreamChatRoomEvents, listenForSubscriptionEvents, listenForUserBitsUpdateEvents, listenForUserCampaignEvents, listenForUserChannelPointsEvents, listenForUserChatroomEvents, listenForUserDropEvents, listenForUserImageUpdateEvents, listenForUserModerationNotificationEvents, listenForUserPredictionsEvents, listenForUserPropertiesUpdateEvents, listenForUserSubscribeEvents, listenForUserUnbanRequestEvents, listenForVideoPlaybackByNameEvents, listenForVideoPlaybackEvents, listenForWatchPartyEvents, listenForWhisperEvents, listenOnTopic, listenOnTopic, listenOnTopic
-
Felddetails
-
REQUIRED_THREAD_COUNT
public static final int REQUIRED_THREAD_COUNT- Siehe auch:
-
queueTask
Command Queue Thread -
heartbeatTask
Heartbeat Thread -
isClosed
protected volatile boolean isClosedis Closed? -
commandQueue
Command Queue -
subscribedTopics
Holds the subscribed topics in case we need to reconnect -
lastPing
protected volatile long lastPingLast Ping send (1 minute delay before sending the first ping) -
lastPong
protected volatile long lastPongLast Pong received -
taskExecutor
Thread Pool Executor
-
-
Konstruktordetails
-
TwitchPubSub
public TwitchPubSub(WebsocketConnection websocketConnection, EventManager eventManager, ScheduledThreadPoolExecutor taskExecutor, ProxyConfig proxyConfig, Collection<String> botOwnerIds, int wsPingPeriod, IBackoffStrategy connectionBackoffStrategy, int wsCloseDelay, Consumer<PubSubResponsePayload> fallbackTopicHandler) Constructor- Parameter:
websocketConnection- WebsocketConnectioneventManager- EventManagertaskExecutor- ScheduledThreadPoolExecutorproxyConfig- ProxyConfigbotOwnerIds- Bot Owner IDswsPingPeriod- WebSocket Ping PeriodconnectionBackoffStrategy- WebSocket Connection Backoff StrategywsCloseDelay- Websocket Close DelayfallbackTopicHandler- Fallback Topic Handler
-
-
Methodendetails
-
connect
public void connect()Connecting to IRC-WS -
disconnect
public void disconnect()Disconnecting from WebSocket -
reconnect
public void reconnect()Reconnecting to WebSocket -
onPreConnect
protected void onPreConnect() -
onConnected
protected void onConnected() -
onTextMessage
-
listenOnTopic
Beschreibung aus Schnittstelle kopiert:ITwitchPubSubSend WS Message to subscribe to a topic- Angegeben von:
listenOnTopicin SchnittstelleITwitchPubSub- Parameter:
request- Topic- Gibt zurück:
- PubSubSubscription to be listened to
-
unsubscribeFromTopic
Beschreibung aus Schnittstelle kopiert:ITwitchPubSubUnsubscribe from a topic. Usage example:PubSubSubscription subscription = twitchPubSub.listenForCheerEvents(...); // ... twitchPubSub.unsubscribeFromTopic(subscription);- Angegeben von:
unsubscribeFromTopicin SchnittstelleITwitchPubSub- Parameter:
subscription- PubSubSubscription to be unlistened from- Gibt zurück:
- whether the subscription was previously subscribed to
-
getLatency
public long getLatency()- Angegeben von:
getLatencyin SchnittstelleITwitchPubSub- Gibt zurück:
- the most recently measured round-trip latency for the socket(s) in milliseconds, or -1 if unknown
-
close
public void close()Close- Angegeben von:
closein SchnittstelleAutoCloseable- Angegeben von:
closein SchnittstelleITwitchPubSub
-
getEventManager
EventManager- Angegeben von:
getEventManagerin SchnittstelleITwitchPubSub
-