Class HttpHubConnectionBuilder


  • public class HttpHubConnectionBuilder
    extends java.lang.Object
    A builder for configuring HubConnection instances.
    • Method Detail

      • 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.
      • shouldSkipNegotiate

        public HttpHubConnectionBuilder shouldSkipNegotiate​(boolean skipNegotiate)
        Indicates to the HubConnection that it should skip the negotiate process. Note: This option only works with the TransportEnum.WEBSOCKETS transport selected via withTransport, additionally the Azure SignalR Service requires the negotiate step so this will fail when using the Azure SignalR Service.
        Parameters:
        skipNegotiate - Boolean indicating if the HubConnection 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 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.
      • withHeaders

        public HttpHubConnectionBuilder withHeaders​(java.util.Map<java.lang.String,​java.lang.String> 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.
      • withHeader

        public HttpHubConnectionBuilder withHeader​(java.lang.String name,
                                                   java.lang.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.
      • 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.