Class EventSocketWelcomedEvent

java.lang.Object
com.github.twitch4j.eventsub.socket.events.EventSocketWelcomedEvent

public final class EventSocketWelcomedEvent extends Object
Fired when a TwitchEventSocket receives a SocketMessageType.SESSION_WELCOME message.

As a result, TwitchEventSocket.getWebsocketId() will be populated, which allows for EventSub subscriptions to be registered with Twitch's Helix API.

  • Constructor Details

    • EventSocketWelcomedEvent

      public EventSocketWelcomedEvent(TwitchEventSocket connection, String sessionId, boolean sessionChanged)
      Creates a new EventSocketWelcomedEvent instance.
      Parameters:
      connection - The EventSocket instance whose connection status changed.
      sessionId - The ID that was assigned to the websocket upon connect.
      sessionChanged - Whether the Session ID changed due to the session_welcome handshake.

      If false (i.e., the Session ID did not change), then the websocket simply reconnected at the request of Twitch (while preserving any subscriptions).

      This field is always true upon the initial connection.

  • Method Details

    • getConnection

      public TwitchEventSocket getConnection()
      The EventSocket instance whose connection status changed.
    • getSessionId

      public String getSessionId()
      The ID that was assigned to the websocket upon connect.
    • isSessionChanged

      public boolean isSessionChanged()
      Whether the Session ID changed due to the session_welcome handshake.

      If false (i.e., the Session ID did not change), then the websocket simply reconnected at the request of Twitch (while preserving any subscriptions).

      This field is always true upon the initial connection.

    • 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