Interface DaveSessionFactory

All Known Implementing Classes:
PassthroughDaveSessionFactory

public interface DaveSessionFactory
Factory for DaveSessions.

All audio/video connections on Discord use the "Discord Audio & Video Encryption" (DAVE) protocol. By default, JDA does not implement this and falls back to "passthrough mode", which only does transport encryption through AEAD.

To use audio connections with JDA (such as AudioManager.openAudioConnection(AudioChannel)), you must provide an implementation of this factory either in JDABuilder.setAudioModuleConfig(AudioModuleConfig) or DefaultShardManagerBuilder.setAudioModuleConfig(AudioModuleConfig).

  • Method Details

    • createDaveSession

      @Nonnull DaveSession createDaveSession(@Nonnull DaveProtocolCallbacks callbacks, long userId, long channelId)
      Create a new DAVE session.

      The session should not yet be started. JDA will invoke DaveSession.initialize() once a connection to the voice gateway is established.

      The dave session should be started/created in DaveSession.onSelectProtocolAck(int), which will provide the target protocol version.

      Parameters:
      callbacks - The callbacks to facilitate the protocol communication
      userId - The id of the connecting bot (self user)
      channelId - The id of the channel or group of the connection (audio channel)
      Returns:
      DaveSession