/// <summary>
 /// Enables the MessagePack protocol for SignalR.
 /// </summary>
 /// <param name="hubConnectionBuilder">The <see cref="HubConnectionBuilder"/> representing the SignalR server to add MessagePack protocol support to.</param>
 /// <returns>The same instance of the <see cref="HubConnectionBuilder"/> for chaining.</returns>
 public static HubConnectionBuilderEx AddMessagePackProtocol(this HubConnectionBuilderEx hubConnectionBuilder)
 {
     if (hubConnectionBuilder == null)
     {
         throw new ArgumentNullException(nameof(hubConnectionBuilder));
     }
     hubConnectionBuilder.Options.EnableMessagePack = true;
     return(hubConnectionBuilder);
 }
        /// <summary>
        /// Configures the <see cref="HubConnection" /> to use HTTP-based transports to connect to the specified URL.
        /// </summary>
        /// <param name="hubConnectionBuilder">The <see cref="HubConnectionBuilder" /> to configure.</param>
        /// <param name="url">The URL the <see cref="HttpConnection"/> will use.</param>
        /// <returns>The same instance of the <see cref="HubConnectionBuilder"/> for chaining.</returns>
        public static HubConnectionBuilderEx WithUrl(this HubConnectionBuilderEx hubConnectionBuilder, string url, Action <HttpConnectionOptions> configureHttpOptions = null)
        {
            if (hubConnectionBuilder == null)
            {
                throw new ArgumentNullException(nameof(hubConnectionBuilder));
            }
            if (string.IsNullOrWhiteSpace(url))
            {
                throw new ArgumentNullException(nameof(url));
            }

            hubConnectionBuilder.Options.Url = url;
            configureHttpOptions?.Invoke(hubConnectionBuilder.Options);
            return(hubConnectionBuilder);
        }