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
Nested Classes -
Field Summary
Fields inherited from class discord4j.common.ReactorResources
DEFAULT_BLOCKING_TASK_SCHEDULER, DEFAULT_HTTP_CLIENT, DEFAULT_TIMER_TASK_SCHEDULER -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate Voice Gateway resources based offReactorResourcesproperties, and providing defaults for the remaining properties.VoiceReactorResources(ReactorResources parent, UdpClient udpClient, Scheduler sendTaskScheduler, Scheduler receiveTaskScheduler) Create Voice Gateway resources based offReactorResourcesproperties, and allowing customization of the remaining properties.protectedVoiceReactorResources(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 createVoiceReactorResourcesfrom a pre-configuredReactorResources, copying its settings.static VoiceReactorResourcescreate()Create a default set of Voice Gateway resources.Returns theSchedulerused to run the voice receive loop.Returns theSchedulerused to run the voice send loop.Returns the UDP client used to create voice protocol connections.mutate()Returns a builder to create a newVoiceReactorResourceswith 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 offReactorResourcesproperties, 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 offReactorResourcesproperties, 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_CLIENTtimerTaskScheduler- the scheduler for timed tasks. A default can be created fromReactorResources.DEFAULT_TIMER_TASK_SCHEDULERblockingTaskScheduler- the scheduler for blocking tasks. A default can be created fromReactorResources.DEFAULT_BLOCKING_TASK_SCHEDULERudpClient- 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
VoiceReactorResourcesusing all default properties
-
builder
Returns a new builder to createVoiceReactorResources.- Returns:
- a builder to create
VoiceReactorResources
-
builder
Returns a new builder to createVoiceReactorResourcesfrom a pre-configuredReactorResources, copying its settings.- Returns:
- a builder to create
VoiceReactorResourceswith settings copied from parent resources
-
mutate
Returns a builder to create a newVoiceReactorResourceswith 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 theSchedulerused to run the voice send loop.- Returns:
- the send scheduler
-
getReceiveTaskScheduler
Returns theSchedulerused to run the voice receive loop.- Returns:
- the receive scheduler
-