Package com.microsoft.signalr
Class HttpHubConnectionBuilder
- java.lang.Object
-
- com.microsoft.signalr.HttpHubConnectionBuilder
-
public class HttpHubConnectionBuilder extends java.lang.Object
A builder for configuringHubConnection
instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HubConnection
build()
Builds a new instance ofHubConnection
.HttpHubConnectionBuilder
setHttpClientBuilderCallback(Action1<okhttp3.OkHttpClient.Builder> configureBuilder)
Sets a method that will be called when constructing the HttpClient to allow customization such as certificate validation, proxies, and cookies.HttpHubConnectionBuilder
shouldSkipNegotiate(boolean skipNegotiate)
Indicates to theHubConnection
that it should skip the negotiate process.HttpHubConnectionBuilder
withAccessTokenProvider(io.reactivex.rxjava3.core.Single<java.lang.String> accessTokenProvider)
Sets the access token provider for theHubConnection
.HttpHubConnectionBuilder
withHandshakeResponseTimeout(long timeoutInMilliseconds)
Sets the duration theHubConnection
should wait for a Handshake Response from the server.HttpHubConnectionBuilder
withHeader(java.lang.String name, java.lang.String value)
Sets a single header for theHubConnection
to send.HttpHubConnectionBuilder
withHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Sets a collection of Headers for theHubConnection
to send with every Http request.HttpHubConnectionBuilder
withHubProtocol(HubProtocol protocol)
Sets theHubProtocol
to be used by theHubConnection
.HttpHubConnectionBuilder
withTransport(TransportEnum transportEnum)
Sets the transport type to indicate which transport to be used by theHubConnection
.
-
-
-
Method Detail
-
withTransport
public HttpHubConnectionBuilder withTransport(TransportEnum transportEnum)
Sets the transport type to indicate which transport to be used by theHubConnection
.- Parameters:
transportEnum
- The type of transport to be used.- Returns:
- This instance of the HttpHubConnectionBuilder.
-
withHubProtocol
public HttpHubConnectionBuilder withHubProtocol(HubProtocol protocol)
Sets theHubProtocol
to be used by theHubConnection
.- Parameters:
protocol
- TheHubProtocol
to be used by theHubConnection
.- Returns:
- This instance of the HttpHubConnectionBuilder.
-
shouldSkipNegotiate
public HttpHubConnectionBuilder shouldSkipNegotiate(boolean skipNegotiate)
Indicates to theHubConnection
that it should skip the negotiate process. Note: This option only works with theTransportEnum.WEBSOCKETS
transport selected viawithTransport
, additionally the Azure SignalR Service requires the negotiate step so this will fail when using the Azure SignalR Service.- Parameters:
skipNegotiate
- Boolean indicating if theHubConnection
should skip the negotiate step.- Returns:
- This instance of the HttpHubConnectionBuilder.
-
withAccessTokenProvider
public HttpHubConnectionBuilder withAccessTokenProvider(io.reactivex.rxjava3.core.Single<java.lang.String> accessTokenProvider)
Sets the access token provider for theHubConnection
.- Parameters:
accessTokenProvider
- The access token provider to be used by theHubConnection
.- Returns:
- This instance of the HttpHubConnectionBuilder.
-
withHandshakeResponseTimeout
public HttpHubConnectionBuilder withHandshakeResponseTimeout(long timeoutInMilliseconds)
Sets the duration theHubConnection
should wait for a Handshake Response from the server.- Parameters:
timeoutInMilliseconds
- The duration (specified in milliseconds) that theHubConnection
should wait for a Handshake Response from the server.- Returns:
- This instance of the HttpHubConnectionBuilder.
-
withHeaders
public HttpHubConnectionBuilder withHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Sets a collection of Headers for theHubConnection
to send with every Http request.- Parameters:
headers
- A Map representing the collection of Headers that theHubConnection
should send.- Returns:
- This instance of the HttpHubConnectionBuilder.
-
withHeader
public HttpHubConnectionBuilder withHeader(java.lang.String name, java.lang.String value)
Sets a single header for theHubConnection
to send.- Parameters:
name
- The name of the header to set.value
- The value of the header to be set.- Returns:
- This instance of the HttpHubConnectionBuilder.
-
setHttpClientBuilderCallback
public HttpHubConnectionBuilder setHttpClientBuilderCallback(Action1<okhttp3.OkHttpClient.Builder> configureBuilder)
Sets a method that will be called when constructing the HttpClient to allow customization such as certificate validation, proxies, and cookies. By default the client will have a cookie jar added and a read timeout for LongPolling.- Parameters:
configureBuilder
- Callback for configuring the OkHttpClient.Builder.- Returns:
- This instance of the HttpHubConnectionBuilder.
-
build
public HubConnection build()
Builds a new instance ofHubConnection
.- Returns:
- A new instance of
HubConnection
.
-
-