Class EventDispatcher

java.lang.Object
moe.kyokobot.koe.internal.EventDispatcher
All Implemented Interfaces:
KoeEventListener

public class EventDispatcher extends Object implements KoeEventListener
  • Method Details

    • gatewayError

      public void gatewayError(Throwable cause)
      Specified by:
      gatewayError in interface KoeEventListener
    • gatewayReady

      public void gatewayReady(InetSocketAddress target, int ssrc)
      Specified by:
      gatewayReady in interface KoeEventListener
    • gatewayClosed

      public void gatewayClosed(int code, String reason, boolean byRemote)
      Description copied from interface: KoeEventListener
      Called when the gateway connection is closed.
      Specified by:
      gatewayClosed in interface KoeEventListener
      Parameters:
      code - the WebSocket close code.
      reason - the close reason if present, null otherwise.
      byRemote - true if the connection was closed by the gateway, false if it was closed by Koe.
    • sessionLost

      public void sessionLost(int code, String reason)
      Description copied from interface: KoeEventListener
      Called after KoeEventListener.gatewayClosed(int, java.lang.String, boolean) when the voice server no longer knows the session and Koe couldn't start a new one. Koe can't recover from this on its own, the bot has to rejoin the voice channel through the main gateway (opcode 4) to get a new session and pass the new server info to MediaConnection.connect(moe.kyokobot.koe.VoiceServerInfo).
      Specified by:
      sessionLost in interface KoeEventListener
      Parameters:
      code - the WebSocket close code.
      reason - the close reason if present, null otherwise.
    • userStreamsChanged

      public void userStreamsChanged(String id, int audioSSRC, int videoSSRC, int rtxSSRC)
      Description copied from interface: KoeEventListener
      Called when the stream information for a user has changed. Not state tracked by Koe, provides data from moe.kyokobot.koe.gateway.Op#USER_SPEAKING as-is.
      Specified by:
      userStreamsChanged in interface KoeEventListener
      Parameters:
      id - the user ID of the user whose stream information has changed.
      audioSSRC - the SSRC of the user's audio stream, or 0 if not present or just disabled.
      videoSSRC - the SSRC of the user's video stream, or 0 if not present or just disabled.
      rtxSSRC - the SSRC of the user's retransmission stream, or 0 if not present or just disabled.
    • usersConnected

      public void usersConnected(List<String> userIds)
      Description copied from interface: KoeEventListener
      Called when one or more users have connected to the voice channel. Not state tracked by Koe, provides data from Op.CLIENT_CONNECT as-is.
      Specified by:
      usersConnected in interface KoeEventListener
      Parameters:
      userIds - the list of user IDs that have connected, as provided by the gateway.
    • userDisconnected

      public void userDisconnected(String id)
      Description copied from interface: KoeEventListener
      Called when one or more users have disconnected from the voice channel. Not state tracked by Koe, provides data from Op.CLIENT_DISCONNECT as-is.
      Specified by:
      userDisconnected in interface KoeEventListener
    • externalIPDiscovered

      public void externalIPDiscovered(InetSocketAddress address)
      Specified by:
      externalIPDiscovered in interface KoeEventListener
    • sessionDescription

      public void sessionDescription(JsonObject session)
      Specified by:
      sessionDescription in interface KoeEventListener