Class VoiceWebsocketHandler


  • public class VoiceWebsocketHandler
    extends Object
    Represents a WebSocket handler specialized for Discord voice gateway operations.

    Capable of handling closing events that normally occur in its lifecycle.

    This handler uses a FluxSink of ByteBuf to push inbound payloads and a Flux of ByteBuf to pull outbound payloads.

    The handler also provides methods to control the lifecycle, which perform operations on the current session. It is required to use them to properly release important resources and complete the session.

    • Constructor Detail

      • VoiceWebsocketHandler

        public VoiceWebsocketHandler​(Sinks.Many<ByteBuf> inbound,
                                     Flux<ByteBuf> outbound,
                                     ContextView context)
        Create a new handler with the given data pipelines.
        Parameters:
        inbound - the Sinks.Many of ByteBuf to process inbound payloads
        outbound - the Flux of ByteBuf to process outbound payloads
        context - the Reactor ContextView that owns this handler, to enrich logging
    • Method Detail

      • close

        public void close()
        Initiates a close sequence that will terminate this session and instruct consumers downstream that a reconnect should take place afterwards.
      • error

        public void error​(Throwable error)
        Initiates a close sequence with the given error. The session will be terminated abruptly and then instruct consumers downstream that a reconnect should take place afterwards.
        Parameters:
        error - the cause for this session termination