public.javadoc.org.spincast.plugins.httpclient.websocket.builders.WebsocketRequestBuilder.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
WebsocketRequestBuilder (org.spincast:spincast-framework 1.0.0 API)
org.spincast.plugins.httpclient.websocket.builders
Interface WebsocketRequestBuilder
-
- All Superinterfaces:
- HttpRequestBuilder<WebsocketRequestBuilder>
- All Known Implementing Classes:
- WebsocketRequestBuilderDefault
public interface WebsocketRequestBuilder
extends HttpRequestBuilder<WebsocketRequestBuilder>
Builder to create a WebSocket requesté
-
-
Method Summary
All Methods Instance Methods Abstract Methods
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.
-
Methods inherited from interface org.spincast.plugins.httpclient.HttpRequestBuilder
addHeaderValue, addHeaderValues, addHTMLAcceptHeader, addJsonAcceptHeader, addPlainTextAcceptHeader, addXMLAcceptHeader, disableRedirectHandling, disableSslCertificateErrors, setCookie, setCookie, setCookie, setCookies, setHeaders, setHeaderValues, setHttpAuthCredentials, setHttpClientBuilder, setRequestConfig
-
-
Method Detail
-
ping
WebsocketRequestBuilder ping(int seconds)
You can use this to configure the pings that are automatically sent
to the Websocket endpoint every X 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.
- Parameters:
seconds
- the interval in seconds or <= 0 to disable the pings.
-
connect
WebsocketClientWriter connect(WebsocketClientHandler handler)
Sends the request and establish the WebSocket connection.
- Parameters:
handler
- The handler that is responsible to
handle the various WebSocket events.
- Returns:
- a writer to send WebSocket messages to the connected endpoint.
-
send
HttpResponse send()
Sends the request and gets the 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.
- Specified by:
send
in interface HttpRequestBuilder<WebsocketRequestBuilder>
Copyright © 2019. All rights reserved.