Interface IEventSubSocket
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
TwitchEventSocket
,TwitchEventSocketPool
,TwitchSingleUserEventSocketPool
-
Method Summary
Modifier and TypeMethodDescriptionvoid
connect()
Establishes a connection to the EventSub WebSocket server.void
Disconnects from the WebSocket server.com.github.philippheuer.credentialmanager.domain.OAuth2Credential
com.github.philippheuer.events4j.api.IEventManager
long
void
Reconnects to the WebSocket server.boolean
register
(com.github.philippheuer.credentialmanager.domain.OAuth2Credential token, EventSubSubscription sub) Creates (or schedules) an eventsub subscription for this socket.default boolean
Creates (or schedules) an eventsub subscription for this socket, usinggetDefaultToken()
.default <C extends EventSubCondition,
B, E extends EventSubEvent>
booleanregister
(SubscriptionType<C, B, E> type, C condition) Deprecated.default <C extends EventSubCondition,
B, E extends EventSubEvent>
booleanregister
(SubscriptionType<C, B, E> type, Function<B, C> conditions) Helper method forregister(EventSubSubscription)
boolean
Deletes an eventsub subscription from helix (and this socket).Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
getEventManager
com.github.philippheuer.events4j.api.IEventManager getEventManager()- Returns:
- the event manager for eventsub notifications
-
getDefaultToken
com.github.philippheuer.credentialmanager.domain.OAuth2Credential getDefaultToken()- Returns:
- the default token to use when creating subscriptions
-
connect
void connect()Establishes a connection to the EventSub WebSocket server.- See Also:
-
disconnect
void disconnect()Disconnects from the WebSocket server.- See Also:
-
reconnect
void reconnect()Reconnects to the WebSocket server.- See Also:
-
getSubscriptions
Collection<EventSubSubscription> getSubscriptions()- Returns:
- the eventsub subscriptions associated with this socket
-
register
boolean register(com.github.philippheuer.credentialmanager.domain.OAuth2Credential token, EventSubSubscription sub) Creates (or schedules) an eventsub subscription for this socket.- Parameters:
token
- the token to use for creating this subscription via helixsub
- the eventsub subscription to be registered- Returns:
- whether this subscription was not already registered to this pool (and, if the websocket is already connected, whether the subscription was successful)
-
unregister
Deletes an eventsub subscription from helix (and this socket).- Parameters:
sub
- the eventsub subscription to be destroyed- Returns:
- whether the specified subscription was previously registered with this socket
-
getLatency
long getLatency()- Returns:
- the most recently measured round-trip latency for the socket(s) in milliseconds, or -1 if unknown
-
register
Creates (or schedules) an eventsub subscription for this socket, usinggetDefaultToken()
.- Parameters:
sub
- the eventsub subscription to be created- Returns:
- whether this subscription was not already registered to this pool (and, if the websocket is already connected, whether the subscription was successful)
- See Also:
-
register
default <C extends EventSubCondition,B, boolean registerE extends EventSubEvent> (SubscriptionType<C, B, E> type, Function<B, C> conditions) Helper method forregister(EventSubSubscription)
-
register
@Deprecated @ScheduledForRemoval(inVersion="2.0.0") default <C extends EventSubCondition,B, boolean registerE extends EventSubEvent> (SubscriptionType<C, B, E> type, C condition) Deprecated.in favor ofregister(SubscriptionType, Function)
Helper method forregister(SubscriptionType, Function)
-
register(SubscriptionType, Function)