Interface IEventSubSocket

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
TwitchEventSocket, TwitchEventSocketPool, TwitchSingleUserEventSocketPool

public interface IEventSubSocket extends AutoCloseable
  • 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 helix
      sub - 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

      boolean unregister(EventSubSubscription sub)
      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

      default boolean register(EventSubSubscription sub)
      Creates (or schedules) an eventsub subscription for this socket, using getDefaultToken().
      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, E extends EventSubEvent> boolean register(SubscriptionType<C,B,E> type, Function<B,C> conditions)
    • register

      @Deprecated @ScheduledForRemoval(inVersion="2.0.0") default <C extends EventSubCondition, B, E extends EventSubEvent> boolean register(SubscriptionType<C,B,E> type, C condition)
      Deprecated.