public interface WebsocketRequestBuilder extends HttpRequestBuilder<WebsocketRequestBuilder>
| Modifier and Type | Method and Description |
|---|---|
WebsocketClientWriter |
connect(WebsocketClientHandler handler)
Sends the request and establish the WebSocket connection.
|
WebsocketRequestBuilder |
ping(int seconds)
You can use this to configure the pings that are automatically sent
to the Websocket endpoint every X seconds.
|
HttpResponse |
send()
Sends the request and gets the
HTTP response. |
addHeaderValue, addHeaderValues, addHTMLAcceptHeader, addJsonAcceptHeader, addPlainTextAcceptHeader, addXMLAcceptHeader, disableRedirectHandling, disableSslCertificateErrors, setCookie, setCookie, setCookie, setCookies, setHeaders, setHeaderValues, setHttpAuthCredentials, setHttpClientBuilder, setRequestConfigWebsocketRequestBuilder ping(int seconds)
WebsocketClientHandler#onConnectionClosed()
will be called if the connection is closed.
Use a value <= 0 to disable the pings.
The automatic pings and their default interval are also configurable using:
SpincastHttpClientWithWebsocketConfig#isWebsocketAutomaticPingEnabled()
and
SpincastHttpClientWithWebsocketConfig#getWebsocketAutomaticPingIntervalSeconds()
Pings are enabled by default.
seconds - the interval in seconds or <= 0 to disable the pings.WebsocketClientWriter connect(WebsocketClientHandler handler)
handler - The handler that is responsible to
handle the various WebSocket events.HttpResponse send()
HTTP response.
Does not make the actual upgrade to a
WebSocket connection! Use the connect(...)
method if you want the actual WebSocket connection
to be made.
This version is useful to debug the intermediate
HTTP upgrade response made from the server
before the actual WebSocket connection is established.
send in interface HttpRequestBuilder<WebsocketRequestBuilder>Copyright © 2019. All rights reserved.