HttpHubConnectionBuilder Class

  • java.lang.Object
    • com.microsoft.signalr.HttpHubConnectionBuilder

public class HttpHubConnectionBuilder

A builder for configuring HubConnection instances.

Method Summary

Modifier and Type Method and Description
HubConnection build()

Builds a new instance of HubConnection.

HttpHubConnectionBuilder setHttpClientBuilderCallback(Action1<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 the HubConnection that it should skip the negotiate process.

HttpHubConnectionBuilder withAccessTokenProvider(Single<String> accessTokenProvider)

Sets the access token provider for the HubConnection.

HttpHubConnectionBuilder withHandshakeResponseTimeout(long timeoutInMilliseconds)

Sets the duration the HubConnection should wait for a Handshake Response from the server.

HttpHubConnectionBuilder withHeader(String name, String value)

Sets a single header for the HubConnection to send.

HttpHubConnectionBuilder withHeaders(Map<String,String> headers)

Sets a collection of Headers for the HubConnection to send with every Http request.

HttpHubConnectionBuilder withHubProtocol(HubProtocol protocol)

Sets the HubProtocol to be used by the HubConnection.

HttpHubConnectionBuilder withTransport(TransportEnum transportEnum)

Sets the transport type to indicate which transport to be used by the HubConnection.

Inherited Members

java.lang.Object.clone() java.lang.Object.equals(java.lang.Object) java.lang.Object.finalize() java.lang.Object.getClass() java.lang.Object.hashCode() java.lang.Object.notify() java.lang.Object.notifyAll() java.lang.Object.toString() java.lang.Object.wait() java.lang.Object.wait(long) java.lang.Object.wait(long,int)

Method Details

build

public HubConnection build()

Builds a new instance of HubConnection.

Returns:

A new instance of HubConnection.

setHttpClientBuilderCallback

public HttpHubConnectionBuilder setHttpClientBuilderCallback(Action1 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.

shouldSkipNegotiate

public HttpHubConnectionBuilder shouldSkipNegotiate(boolean skipNegotiate)

Indicates to the HubConnection that it should skip the negotiate process. Note: This option only works with the Websockets transport and the Azure SignalR Service require the negotiate step.

Parameters:

skipNegotiate - Boolean indicating if the HubConnection should skip the negotiate step.

Returns:

This instance of the HttpHubConnectionBuilder.

withAccessTokenProvider

public HttpHubConnectionBuilder withAccessTokenProvider(Single accessTokenProvider)

Sets the access token provider for the HubConnection.

Parameters:

accessTokenProvider - The access token provider to be used by the HubConnection.

Returns:

This instance of the HttpHubConnectionBuilder.

withHandshakeResponseTimeout

public HttpHubConnectionBuilder withHandshakeResponseTimeout(long timeoutInMilliseconds)

Sets the duration the HubConnection should wait for a Handshake Response from the server.

Parameters:

timeoutInMilliseconds - The duration (specified in milliseconds) that the HubConnection should wait for a Handshake Response from the server.

Returns:

This instance of the HttpHubConnectionBuilder.

withHeader

public HttpHubConnectionBuilder withHeader(String name, String value)

Sets a single header for the HubConnection 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.

withHeaders

public HttpHubConnectionBuilder withHeaders(Map headers)

Sets a collection of Headers for the HubConnection to send with every Http request.

Parameters:

headers - A Map representing the collection of Headers that the HubConnection should send.

Returns:

This instance of the HttpHubConnectionBuilder.

withHubProtocol

public HttpHubConnectionBuilder withHubProtocol(HubProtocol protocol)

Sets the HubProtocol to be used by the HubConnection.

Parameters:

protocol - The HubProtocol to be used by the HubConnection.

Returns:

This instance of the HttpHubConnectionBuilder.

withTransport

public HttpHubConnectionBuilder withTransport(TransportEnum transportEnum)

Sets the transport type to indicate which transport to be used by the HubConnection.

Parameters:

transportEnum - The type of transport to be used.

Returns:

This instance of the HttpHubConnectionBuilder.

Applies to