Search in sources :

Example 1 with WebSocketClient

use of net.dv8tion.jda.internal.requests.WebSocketClient in project JDA by DV8FromTheWorld.

the class DirectAudioControllerImpl method connect.

@Override
public void connect(@Nonnull AudioChannel channel) {
    Checks.notNull(channel, "Audio Channel");
    JDAImpl jda = getJDA();
    WebSocketClient client = jda.getClient();
    client.queueAudioConnect(channel);
}
Also used : JDAImpl(net.dv8tion.jda.internal.JDAImpl) WebSocketClient(net.dv8tion.jda.internal.requests.WebSocketClient)

Example 2 with WebSocketClient

use of net.dv8tion.jda.internal.requests.WebSocketClient in project JDA by DV8FromTheWorld.

the class GuildSetupController method checkReady.

// Check if we can send a ready event
private void checkReady() {
    WebSocketClient client = getJDA().getClient();
    // If no guilds are marked as incomplete we can fire a ready
    if (incompleteCount < 1 && !client.isReady()) {
        if (timeoutHandle != null)
            timeoutHandle.cancel(false);
        timeoutHandle = null;
        client.ready();
    } else if (incompleteCount <= timeoutThreshold) {
        // try to timeout the other guilds
        startTimeout();
    }
}
Also used : WebSocketClient(net.dv8tion.jda.internal.requests.WebSocketClient)

Example 3 with WebSocketClient

use of net.dv8tion.jda.internal.requests.WebSocketClient in project JDA by DV8FromTheWorld.

the class DirectAudioControllerImpl method update.

/**
 * Used to update the internal state of the voice request. When a connection
 * was successfully established JDA will stop sending requests for the initial connect.
 * <br>This is done to retry the voice updates in case of a partial service failure.
 *
 * <p>Should be called when:
 * <ol>
 *     <li>Receiving a Voice State Update for the current account and we were previously connected (moved or disconnected)</li>
 *     <li>Receiving a Voice Server Update (initial connect or region change)</li>
 * </ol>
 *
 * Note that the voice state update will always be received prior to a voice server update.
 * <br>The internal dispatch handlers already call this when needed, a library end-user never needs to call this method.
 *
 * @param guild
 *        The guild to update the state for
 * @param channel
 *        The new channel, or null to signal disconnect
 */
public void update(Guild guild, AudioChannel channel) {
    Checks.notNull(guild, "Guild");
    JDAImpl jda = getJDA();
    WebSocketClient client = jda.getClient();
    client.updateAudioConnection(guild.getIdLong(), channel);
}
Also used : JDAImpl(net.dv8tion.jda.internal.JDAImpl) WebSocketClient(net.dv8tion.jda.internal.requests.WebSocketClient)

Example 4 with WebSocketClient

use of net.dv8tion.jda.internal.requests.WebSocketClient in project JDA by DV8FromTheWorld.

the class DirectAudioControllerImpl method disconnect.

@Override
public void disconnect(@Nonnull Guild guild) {
    Checks.notNull(guild, "Guild");
    JDAImpl jda = getJDA();
    WebSocketClient client = jda.getClient();
    client.queueAudioDisconnect(guild);
}
Also used : JDAImpl(net.dv8tion.jda.internal.JDAImpl) WebSocketClient(net.dv8tion.jda.internal.requests.WebSocketClient)

Example 5 with WebSocketClient

use of net.dv8tion.jda.internal.requests.WebSocketClient in project JDA by DV8FromTheWorld.

the class DirectAudioControllerImpl method reconnect.

@Override
public void reconnect(@Nonnull AudioChannel channel) {
    Checks.notNull(channel, "Audio Channel");
    JDAImpl jda = getJDA();
    WebSocketClient client = jda.getClient();
    client.queueAudioReconnect(channel);
}
Also used : JDAImpl(net.dv8tion.jda.internal.JDAImpl) WebSocketClient(net.dv8tion.jda.internal.requests.WebSocketClient)

Aggregations

WebSocketClient (net.dv8tion.jda.internal.requests.WebSocketClient)5 JDAImpl (net.dv8tion.jda.internal.JDAImpl)4