Class StandardWebSocketBuilder
- java.lang.Object
-
- io.fabric8.kubernetes.client.http.StandardWebSocketBuilder
-
- All Implemented Interfaces:
BasicBuilder
,WebSocket.Builder
public class StandardWebSocketBuilder extends Object implements WebSocket.Builder
-
-
Constructor Summary
Constructors Constructor Description StandardWebSocketBuilder(StandardHttpClient<?,?,?> httpClient)
StandardWebSocketBuilder(StandardHttpClient<?,?,?> httpClient, StandardHttpRequest.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StandardHttpRequest
asHttpRequest()
CompletableFuture<WebSocket>
buildAsync(WebSocket.Listener listener)
Builds a new WebSocket connection and waits asynchronously until the connection is opened.WebSocket.Builder
connectTimeout(long timeout, TimeUnit timeUnit)
StandardWebSocketBuilder
header(String name, String value)
Add the key value pair.StandardWebSocketBuilder
newBuilder()
StandardWebSocketBuilder
setHeader(String k, String v)
Set the key value pair.StandardWebSocketBuilder
subprotocol(String protocol)
Protocol used for WebSocket message exchange.StandardWebSocketBuilder
uri(URI uri)
-
-
-
Constructor Detail
-
StandardWebSocketBuilder
public StandardWebSocketBuilder(StandardHttpClient<?,?,?> httpClient)
-
StandardWebSocketBuilder
public StandardWebSocketBuilder(StandardHttpClient<?,?,?> httpClient, StandardHttpRequest.Builder builder)
-
-
Method Detail
-
buildAsync
public CompletableFuture<WebSocket> buildAsync(WebSocket.Listener listener)
Description copied from interface:WebSocket.Builder
Builds a new WebSocket connection and waits asynchronously until the connection is opened. The listener onOpen callback is called before the returned future is completed.- Specified by:
buildAsync
in interfaceWebSocket.Builder
- Returns:
- CompletableFuture which is completed after connection is opened
-
subprotocol
public StandardWebSocketBuilder subprotocol(String protocol)
Description copied from interface:WebSocket.Builder
Protocol used for WebSocket message exchange.The client can request that the server use a specific subprotocol by including the |Sec-WebSocket-Protocol| field in its handshake. If it is specified, the server needs to include the same field and one of the selected subprotocol values in its response for the connection to be established.
RFC 6455: Section 1.9, Subprotocols Using the WebSocket Protocol- Specified by:
subprotocol
in interfaceWebSocket.Builder
- Parameters:
protocol
- the protocol to be used.- Returns:
- this builder.
-
header
public StandardWebSocketBuilder header(String name, String value)
Description copied from interface:BasicBuilder
Add the key value pair. Will append to an existing key.- Specified by:
header
in interfaceBasicBuilder
- Specified by:
header
in interfaceWebSocket.Builder
- Parameters:
name
- keyvalue
- value- Returns:
- the builder
-
setHeader
public StandardWebSocketBuilder setHeader(String k, String v)
Description copied from interface:BasicBuilder
Set the key value pair. Will overwrite an existing key.- Specified by:
setHeader
in interfaceBasicBuilder
- Specified by:
setHeader
in interfaceWebSocket.Builder
- Parameters:
k
- keyv
- value- Returns:
- the builder
-
uri
public StandardWebSocketBuilder uri(URI uri)
- Specified by:
uri
in interfaceBasicBuilder
- Specified by:
uri
in interfaceWebSocket.Builder
-
newBuilder
public StandardWebSocketBuilder newBuilder()
-
asHttpRequest
public StandardHttpRequest asHttpRequest()
-
connectTimeout
public WebSocket.Builder connectTimeout(long timeout, TimeUnit timeUnit)
- Specified by:
connectTimeout
in interfaceWebSocket.Builder
-
-