Package discord4j.voice
Class VoiceReactorResources
java.lang.Object
discord4j.common.ReactorResources
discord4j.voice.VoiceReactorResources
Provides an extra level of configuration for
ReactorResources
, tailored for the Voice Gateway operations.
Allows customizing the Scheduler
used to send and receive voice packets and also the UdpClient
template for establishing UDP connections.
-
Nested Class Summary
-
Field Summary
Fields inherited from class discord4j.common.ReactorResources
DEFAULT_BLOCKING_TASK_SCHEDULER, DEFAULT_HTTP_CLIENT, DEFAULT_TIMER_TASK_SCHEDULER
-
Constructor Summary
ModifierConstructorDescriptionCreate Voice Gateway resources based offReactorResources
properties, and providing defaults for the remaining properties.VoiceReactorResources
(ReactorResources parent, UdpClient udpClient, Scheduler sendTaskScheduler, Scheduler receiveTaskScheduler) Create Voice Gateway resources based offReactorResources
properties, and allowing customization of the remaining properties.protected
VoiceReactorResources
(HttpClient httpClient, Scheduler timerTaskScheduler, Scheduler blockingTaskScheduler, UdpClient udpClient, Scheduler sendTaskScheduler, Scheduler receiveTaskScheduler) Create Voice Gateway resources allowing full customization of its properties. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Returns a new builder to createVoiceReactorResources
.builder
(ReactorResources reactorResources) Returns a new builder to createVoiceReactorResources
from a pre-configuredReactorResources
, copying its settings.static VoiceReactorResources
create()
Create a default set of Voice Gateway resources.Returns theScheduler
used to run the voice receive loop.Returns theScheduler
used to run the voice send loop.Returns the UDP client used to create voice protocol connections.mutate()
Returns a builder to create a newVoiceReactorResources
with settings copied from the currentVoiceReactorResources
.Methods inherited from class discord4j.common.ReactorResources
getBlockingTaskScheduler, getHttpClient, getTimerTaskScheduler, newHttpClient, newHttpClient
-
Constructor Details
-
VoiceReactorResources
Create Voice Gateway resources based offReactorResources
properties, and providing defaults for the remaining properties.- Parameters:
parent
- the resources instance to get properties from
-
VoiceReactorResources
public VoiceReactorResources(ReactorResources parent, UdpClient udpClient, Scheduler sendTaskScheduler, Scheduler receiveTaskScheduler) Create Voice Gateway resources based offReactorResources
properties, and allowing customization of the remaining properties.- Parameters:
parent
- the resources instance to get properties fromudpClient
- the UDP client used to create voice protocol connectionssendTaskScheduler
- the scheduler used to run the voice send loopreceiveTaskScheduler
- the scheduler used to run the voice receive loop
-
VoiceReactorResources
public VoiceReactorResources(HttpClient httpClient, Scheduler timerTaskScheduler, Scheduler blockingTaskScheduler, UdpClient udpClient, Scheduler sendTaskScheduler, Scheduler receiveTaskScheduler) Create Voice Gateway resources allowing full customization of its properties.- Parameters:
httpClient
- the HTTP client to use for initiating Gateway websocket connections. A default is provided inReactorResources.DEFAULT_HTTP_CLIENT
timerTaskScheduler
- the scheduler for timed tasks. A default can be created fromReactorResources.DEFAULT_TIMER_TASK_SCHEDULER
blockingTaskScheduler
- the scheduler for blocking tasks. A default can be created fromReactorResources.DEFAULT_BLOCKING_TASK_SCHEDULER
udpClient
- the UDP client used to create voice protocol connectionssendTaskScheduler
- the scheduler used to run the voice send loopreceiveTaskScheduler
- the scheduler used to run the voice receive loop
-
VoiceReactorResources
-
-
Method Details
-
create
Create a default set of Voice Gateway resources.- Returns:
- a new
VoiceReactorResources
using all default properties
-
builder
Returns a new builder to createVoiceReactorResources
.- Returns:
- a builder to create
VoiceReactorResources
-
builder
Returns a new builder to createVoiceReactorResources
from a pre-configuredReactorResources
, copying its settings.- Returns:
- a builder to create
VoiceReactorResources
with settings copied from parent resources
-
mutate
Returns a builder to create a newVoiceReactorResources
with settings copied from the currentVoiceReactorResources
.- Returns:
- a builder based off this instance properties
-
getUdpClient
Returns the UDP client used to create voice protocol connections.- Returns:
- the UDP client
-
getSendTaskScheduler
Returns theScheduler
used to run the voice send loop.- Returns:
- the send scheduler
-
getReceiveTaskScheduler
Returns theScheduler
used to run the voice receive loop.- Returns:
- the receive scheduler
-