Class WsClient.Builder

All Implemented Interfaces:
Builder<WsClient.Builder,WsClient>, Supplier<WsClient>
Enclosing interface:
WsClient

public static class WsClient.Builder extends WebClient.Builder<WsClient.Builder,WsClient>
Fluent API builder for WsClient.
  • Method Details

    • build

      public WsClient build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Returns:
      instance of the built type
    • addSubProtocol

      public WsClient.Builder addSubProtocol(String preferred)
      Add sub-protocol. A list of preferred sub-protocols is sent to server, and it chooses zero or one of them.
      Parameters:
      preferred - preferred sub-protocol to use, first one added is considered to be the most desired one
      Returns:
      updated builder instance
    • subProtocols

      public WsClient.Builder subProtocols(String... preferred)
      Configure sub-protocols. A list of preferred sub-protocols is sent to server, and it chooses zero or one of them.
      Parameters:
      preferred - preferred sub-protocols to use
      Returns:
      updated builder instance
    • header

      public WsClient.Builder header(Http.HeaderValue header)
      Configure a custom header to be sent. Some headers cannot be modified (Upgrade, WebSocket version, Content Length).
      Parameters:
      header - header to add
      Returns:
      updated builder instance