Class UndertowWebSocketClient

    • Constructor Detail

      • UndertowWebSocketClient

        public UndertowWebSocketClient​(XnioWorker worker)
        Constructor with the XnioWorker to pass to WebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).
        Parameters:
        worker - the Xnio worker
      • UndertowWebSocketClient

        public UndertowWebSocketClient​(XnioWorker worker,
                                       Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer)
        Alternate constructor providing additional control over the WebSocketClient.ConnectionBuilder for each WebSocket connection.
        Parameters:
        worker - the Xnio worker to use to create ConnectionBuilder's
        builderConsumer - a consumer to configure ConnectionBuilder's
      • UndertowWebSocketClient

        public UndertowWebSocketClient​(XnioWorker worker,
                                       io.undertow.connector.ByteBufferPool byteBufferPool,
                                       Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> builderConsumer)
        Alternate constructor providing additional control over the WebSocketClient.ConnectionBuilder for each WebSocket connection.
        Parameters:
        worker - the Xnio worker to use to create ConnectionBuilder's
        byteBufferPool - the ByteBufferPool to use to create ConnectionBuilder's
        builderConsumer - a consumer to configure ConnectionBuilder's
        Since:
        5.0.8
    • Method Detail

      • setByteBufferPool

        public void setByteBufferPool​(io.undertow.connector.ByteBufferPool byteBufferPool)
        Set the ByteBufferPool to pass to WebSocketClient.connectionBuilder(org.xnio.XnioWorker, io.undertow.connector.ByteBufferPool, java.net.URI).

        By default an indirect DefaultByteBufferPool with a buffer size of 8192 is used.

        Since:
        5.0.8
        See Also:
        DEFAULT_POOL_BUFFER_SIZE
      • getByteBufferPool

        public io.undertow.connector.ByteBufferPool getByteBufferPool()
        Return the ByteBufferPool currently used for newly created WebSocket sessions by this client.
        Returns:
        the byte buffer pool
        Since:
        5.0.8
      • getConnectionBuilderConsumer

        public Consumer<io.undertow.websockets.client.WebSocketClient.ConnectionBuilder> getConnectionBuilderConsumer()
        Return the configured Consumer<ConnectionBuilder>.
      • execute

        public reactor.core.publisher.Mono<Voidexecute​(URI url,
                                                         WebSocketHandler handler)
        Description copied from interface: WebSocketClient
        Execute a handshake request to the given url and handle the resulting WebSocket session with the given handler.
        Specified by:
        execute in interface WebSocketClient
        Parameters:
        url - the handshake url
        handler - the handler of the WebSocket session
        Returns:
        completion Mono<Void> to indicate the outcome of the WebSocket session handling.
      • createConnectionBuilder

        protected io.undertow.websockets.client.WebSocketClient.ConnectionBuilder createConnectionBuilder​(URI url)
        Create a WebSocketClient.ConnectionBuilder for the given URI.

        The default implementation creates a builder with the configured XnioWorker and ByteBufferPool and then passes it to the consumer provided at construction time.