public static IHubConnectionBuilder WithAccessToken(this IHubConnectionBuilder hubConnectionBuilder, Func <string> accessTokenFactory) { if (accessTokenFactory == null) { throw new ArgumentNullException(nameof(accessTokenFactory)); } hubConnectionBuilder.AddSetting(AccessTokenFactoryKey, accessTokenFactory); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithJwtBearer(this IHubConnectionBuilder hubConnectionBuilder, Func <string> jwtBearerTokenFactory) { if (jwtBearerTokenFactory == null) { throw new ArgumentNullException(nameof(jwtBearerTokenFactory)); } hubConnectionBuilder.AddSetting(JwtBearerTokenFactoryKey, jwtBearerTokenFactory); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithWebSocketOptions(this IHubConnectionBuilder hubConnectionBuilder, Action <ClientWebSocketOptions> configureWebSocketOptions) { if (configureWebSocketOptions == null) { throw new ArgumentNullException(nameof(configureWebSocketOptions)); } hubConnectionBuilder.AddSetting(WebSocketOptionsKey, configureWebSocketOptions); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithHeader(this IHubConnectionBuilder hubConnectionBuilder, string name, string value) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Header name cannot be null or empty string.", nameof(name)); } var headers = hubConnectionBuilder.GetHeaders(); if (headers == null) { headers = new Dictionary <string, string>(); hubConnectionBuilder.AddSetting(HeadersKey, headers); } headers.Add(name, value); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithClientCertificate(this IHubConnectionBuilder hubConnectionBuilder, X509Certificate clientCertificate) { if (clientCertificate == null) { throw new ArgumentNullException(nameof(clientCertificate)); } var clientCertificates = hubConnectionBuilder.GetClientCertificates(); if (clientCertificates == null) { clientCertificates = new X509CertificateCollection(); hubConnectionBuilder.AddSetting(ClientCertificatesKey, clientCertificates); } clientCertificates.Add(clientCertificate); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithCookie(this IHubConnectionBuilder hubConnectionBuilder, Cookie cookie) { if (cookie == null) { throw new ArgumentNullException(nameof(cookie)); } var cookies = hubConnectionBuilder.GetCookies(); if (cookies == null) { cookies = new CookieContainer(); hubConnectionBuilder.AddSetting(CookiesKey, cookies); } cookies.Add(cookie); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithLoggerFactory(this IHubConnectionBuilder hubConnectionBuilder, ILoggerFactory loggerFactory) { hubConnectionBuilder.AddSetting(HubConnectionBuilderDefaults.LoggerFactoryKey, loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory))); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithHubProtocol(this IHubConnectionBuilder hubConnectionBuilder, IHubProtocol hubProtocol) { hubConnectionBuilder.AddSetting(HubConnectionBuilderDefaults.HubProtocolKey, hubProtocol); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithMessageHandler(this IHubConnectionBuilder hubConnectionBuilder, HttpMessageHandler httpMessageHandler) { hubConnectionBuilder.AddSetting(HttpMessageHandlerKey, httpMessageHandler); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithTransport(this IHubConnectionBuilder hubConnectionBuilder, TransportType transportType) { hubConnectionBuilder.AddSetting(TransportTypeKey, transportType); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithProxy(this IHubConnectionBuilder hubConnectionBuilder, IWebProxy proxy) { hubConnectionBuilder.AddSetting(ProxyKey, proxy); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithCredentials(this IHubConnectionBuilder hubConnectionBuilder, ICredentials credentials) { hubConnectionBuilder.AddSetting(CredentialsKey, credentials); return(hubConnectionBuilder); }
public static IHubConnectionBuilder WithUseDefaultCredentials(this IHubConnectionBuilder hubConnectionBuilder, bool useDefaultCredentials) { hubConnectionBuilder.AddSetting <bool?>(UseDefaultCredentialsKey, useDefaultCredentials); return(hubConnectionBuilder); }