Esempio n. 1
0
        /// <summary>
        /// GUI button callback
        /// </summary>
        public void OnConnectButton()
        {
            // Set up optional options
            HubOptions options = new HubOptions();

            options.SkipNegotiation = false;

            // Crete the HubConnection
            hub = new HubConnection(new Uri(base.sampleSelector.BaseURL + this._path), new JsonProtocol(new LitJsonEncoder()), options);

            // Optionally add an authenticator
            //hub.AuthenticationProvider = new BestHTTP.SignalRCore.Authentication.HeaderAuthenticator("<generated jwt token goes here>");

            // Subscribe to hub events
            hub.OnConnected += Hub_OnConnected;
            hub.OnError     += Hub_OnError;
            hub.OnClosed    += Hub_OnClosed;

            // Set up server callable functions
            hub.On("Send", (string arg) => AddText(string.Format("On '<color=green>Send</color>': '<color=yellow>{0}</color>'", arg)).AddLeftPadding(20));
            hub.On <Person>("Person", (person) => AddText(string.Format("On '<color=green>Person</color>': '<color=yellow>{0}</color>'", person)).AddLeftPadding(20));
            hub.On <Person, Person>("TwoPersons", (person1, person2) => AddText(string.Format("On '<color=green>TwoPersons</color>': '<color=yellow>{0}</color>', '<color=yellow>{1}</color>'", person1, person2)).AddLeftPadding(20));

            // And finally start to connect to the server
            hub.StartConnect();

            AddText("StartConnect called");

            SetButtons(false, false);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new Yacs <see cref="Hub"/>. This can accept connections from many <see cref="Channel"/> instances.
        /// </summary>
        /// <param name="port">The port on which the server will be listening.</param>
        /// <param name="options">The server options.</param>
        public Hub(int port, HubOptions options = null)
        {
            _port    = port;
            _options = options
                       ?? new HubOptions();

            OptionsValidator.Validate(_options);

            _tcpServer = new TcpListener(IPAddress.Any, port);

            _shouldContinueDiscoveryTask      = true;
            _shouldContinueNewConnectionsTask = true;

            _newChannelOptions = new ChannelOptions
            {
                Encoding            = _options.Encoding,
                ReceptionBufferSize = _options.ReceptionBufferSize,
                ActiveMonitoring    = _options.ActiveChannelMonitoring
            };

            if (_options.IsDiscoverable)
            {
                IsDiscoveryEnabled = true;
                _udpServer         = new UdpClient(_options.DiscoveryPort);
                _discoveryTask     = Task.Run(DiscoveryLoop);
            }

            _enabled = true;
            _tcpServer.Start();
            _newConnectionsTask = Task.Run(NewConnectionListenerLoop);
        }
Esempio n. 3
0
    /// <summary>
    /// Adds an <see cref="IHubFilter"/> type to the <see cref="HubOptions"/> that will be resolved via DI or type activated.
    /// </summary>
    /// <param name="options">The options to add a filter to.</param>
    /// <param name="filterType">The <see cref="IHubFilter"/> type that will be added to the options.</param>
    public static void AddFilter(this HubOptions options, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type filterType)
    {
        _ = options ?? throw new ArgumentNullException(nameof(options));
        _ = filterType ?? throw new ArgumentNullException(nameof(filterType));

        options.AddFilter(new HubFilterFactory(filterType));
    }
Esempio n. 4
0
    void Start()
    {
        // Server side of this example can be found here:
        // https://github.com/Benedicht/BestHTTP_DemoSite/blob/master/BestHTTP_DemoSite/Hubs/TestHub.cs

        // Set up optional options
        HubOptions options = new HubOptions();

        options.SkipNegotiation = false;

        // Crete the HubConnection
        hub = new HubConnection(URI, new JsonProtocol(new LitJsonEncoder()), options);

        // Optionally add an authenticator
        hub.AuthenticationProvider = new BestHTTP.SignalRCore.Authentication.HeaderAuthenticator("<generated jwt token goes here>");

        // Subscribe to hub events
        hub.OnConnected += Hub_OnConnected;
        hub.OnError     += Hub_OnError;
        hub.OnClosed    += Hub_OnClosed;

        hub.OnMessage += Hub_OnMessage;

        // Set up server callable functions
        hub.On("Send", (string arg) => uiText        += string.Format(" On Send: {0}\n", arg));
        hub.On <Person>("Person", (person) => uiText += string.Format(" On Person: {0}\n", person));
        hub.On <Person, Person>("TwoPersons", (person1, person2) => uiText += string.Format(" On TwoPersons: {0}, {1}\n", person1, person2));

        // And finally start to connect to the server
        hub.StartConnect();

        uiText = "StartConnect called\n";
    }
Esempio n. 5
0
    /// <summary>
    /// Initializes a new instance of the <see cref="HubConnectionHandler{THub}"/> class.
    /// </summary>
    /// <param name="lifetimeManager">The hub lifetime manager.</param>
    /// <param name="protocolResolver">The protocol resolver used to resolve the protocols between client and server.</param>
    /// <param name="globalHubOptions">The global options used to initialize hubs.</param>
    /// <param name="hubOptions">Hub specific options used to initialize hubs. These options override the global options.</param>
    /// <param name="loggerFactory">The logger factory.</param>
    /// <param name="userIdProvider">The user ID provider used to get the user ID from a hub connection.</param>
    /// <param name="serviceScopeFactory">The service scope factory.</param>
    /// <remarks>This class is typically created via dependency injection.</remarks>
    public HubConnectionHandler(HubLifetimeManager <THub> lifetimeManager,
                                IHubProtocolResolver protocolResolver,
                                IOptions <HubOptions> globalHubOptions,
                                IOptions <HubOptions <THub> > hubOptions,
                                ILoggerFactory loggerFactory,
                                IUserIdProvider userIdProvider,
                                IServiceScopeFactory serviceScopeFactory
                                )
    {
        _protocolResolver = protocolResolver;
        _lifetimeManager  = lifetimeManager;
        _loggerFactory    = loggerFactory;
        _hubOptions       = hubOptions.Value;
        _globalHubOptions = globalHubOptions.Value;
        _logger           = loggerFactory.CreateLogger <HubConnectionHandler <THub> >();
        _userIdProvider   = userIdProvider;

        _enableDetailedErrors = false;
        bool disableImplicitFromServiceParameters;

        List <IHubFilter>?hubFilters = null;

        if (_hubOptions.UserHasSetValues)
        {
            _maximumMessageSize   = _hubOptions.MaximumReceiveMessageSize;
            _enableDetailedErrors = _hubOptions.EnableDetailedErrors ?? _enableDetailedErrors;
            _maxParallelInvokes   = _hubOptions.MaximumParallelInvocationsPerClient;
            disableImplicitFromServiceParameters = _hubOptions.DisableImplicitFromServicesParameters;

            if (_hubOptions.HubFilters != null)
            {
                hubFilters = new List <IHubFilter>(_hubOptions.HubFilters);
            }
        }
        else
        {
            _maximumMessageSize   = _globalHubOptions.MaximumReceiveMessageSize;
            _enableDetailedErrors = _globalHubOptions.EnableDetailedErrors ?? _enableDetailedErrors;
            _maxParallelInvokes   = _globalHubOptions.MaximumParallelInvocationsPerClient;
            disableImplicitFromServiceParameters = _globalHubOptions.DisableImplicitFromServicesParameters;

            if (_globalHubOptions.HubFilters != null)
            {
                hubFilters = new List <IHubFilter>(_globalHubOptions.HubFilters);
            }
        }

        _dispatcher = new DefaultHubDispatcher <THub>(
            serviceScopeFactory,
            new HubContext <THub>(lifetimeManager),
            _enableDetailedErrors,
            disableImplicitFromServiceParameters,
            new Logger <DefaultHubDispatcher <THub> >(loggerFactory),
            hubFilters,
            lifetimeManager);
    }
Esempio n. 6
0
 public void Configure(HubOptions <THub> options)
 {
     options.SupportedProtocols = new List <string>(_hubOptions.SupportedProtocols.Count);
     foreach (var protocol in _hubOptions.SupportedProtocols)
     {
         options.SupportedProtocols.Add(protocol);
     }
     options.KeepAliveInterval = _hubOptions.KeepAliveInterval;
     options.HandshakeTimeout  = _hubOptions.HandshakeTimeout;
 }
Esempio n. 7
0
    /// <summary>
    /// Adds an instance of an <see cref="IHubFilter"/> to the <see cref="HubOptions"/>.
    /// </summary>
    /// <param name="options">The options to add a filter to.</param>
    /// <param name="hubFilter">The filter instance to add to the options.</param>
    public static void AddFilter(this HubOptions options, IHubFilter hubFilter)
    {
        _ = options ?? throw new ArgumentNullException(nameof(options));
        _ = hubFilter ?? throw new ArgumentNullException(nameof(hubFilter));

        if (options.HubFilters == null)
        {
            options.HubFilters = new List <IHubFilter>();
        }

        options.HubFilters.Add(hubFilter);
    }
Esempio n. 8
0
        public static void Validate(HubOptions serverOptions)
        {
            if (serverOptions.DiscoveryPort < DISCOVERY_PORT_LOWER_LIMIT)
            {
                throw new OptionsException($"{nameof(HubOptions)}.{nameof(HubOptions.DiscoveryPort)} must be equal to or greater than {DISCOVERY_PORT_LOWER_LIMIT}.");
            }

            if (serverOptions.DiscoveryPort > DISCOVERY_PORT_UPPER_LIMIT)
            {
                throw new OptionsException($"{nameof(HubOptions)}.{nameof(HubOptions.DiscoveryPort)} must be less than or equal to {DISCOVERY_PORT_UPPER_LIMIT}.");
            }

            Validate(serverOptions as BaseOptions);
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            var myHubOptions = new HubOptions();

            services.AddRazorPages();
            services.AddServerSideBlazor().AddHubOptions(options =>
            {
                options.MaximumReceiveMessageSize = 16 * 1024;

                myHubOptions.MaximumReceiveMessageSize = options.MaximumReceiveMessageSize;
            });
            services.AddSingleton <WeatherForecastService>();

            services.AddScoped <Func <HubOptions> >(_ => () => myHubOptions);
        }
Esempio n. 10
0
        public void connectToSignalR()
        {
            Debug.Log("trying to connect to signalR");

            HubOptions options = new HubOptions();

            options.SkipNegotiation = false;

            Uri uri = new Uri("https://ar-sphere-server-2.azurewebsites.net/connect");

            connection = new HubConnection(uri, new JsonProtocol(new LitJsonEncoder()), options);

            connection.OnError += (connection, error) =>
            {
                Debug.Log(error);
            };

            connection.OnConnected += (connection) =>
            {
                Debug.Log("connected!!!");
            };


            connection.On("NewNearbyAnchor", async(dynamic anchor) => {
                Debug.Log("new nearby anchor!!!");

                newNearbyAnchors.Add(anchor);

                if (!anchorsToFind.Contains(anchor["id"]))
                {
                    idToModelMap.Add(anchor["id"], anchor["model"] == null ? "Default" : anchor["model"]["name"]);
                    anchorsToFind.Add(anchor["id"]);
                    CloudManager.StopSession();
                    SetAnchorIdsToLocate(anchorsToFind);

                    await CloudManager.StartSessionAsync()
                    .ContinueWith(state => {
                        SetGraphEnabled(true);
                        currentWatcher = CreateWatcher();
                    });
                }
            });

            connection.StartConnect();
        }
Esempio n. 11
0
 internal ServerSignalRTransport(
     IHubContext <EnvelopeHub> hubContext,
     string connectionId,
     Channel <string> envelopeChannel,
     IEnvelopeSerializer envelopeSerializer,
     HubOptions hubOptions,
     HttpConnectionDispatcherOptions httpConnectionDispatcherOptions,
     ITraceWriter traceWriter = null)
     : base(
         envelopeChannel,
         envelopeSerializer,
         traceWriter)
 {
     _hubContext   = hubContext;
     _connectionId = connectionId;
     _hubOptions   = hubOptions;
     _httpConnectionDispatcherOptions = httpConnectionDispatcherOptions;
 }
Esempio n. 12
0
    /// <summary>
    /// Configures the default values of the <see cref="HubOptions"/>.
    /// </summary>
    /// <param name="options">The options to configure.</param>
    public void Configure(HubOptions <THub> options)
    {
        // Do a deep copy, otherwise users modifying the HubOptions<THub> list would be changing the global options list
        options.SupportedProtocols                  = new List <string>(_hubOptions.SupportedProtocols ?? Array.Empty <string>());
        options.KeepAliveInterval                   = _hubOptions.KeepAliveInterval;
        options.HandshakeTimeout                    = _hubOptions.HandshakeTimeout;
        options.ClientTimeoutInterval               = _hubOptions.ClientTimeoutInterval;
        options.EnableDetailedErrors                = _hubOptions.EnableDetailedErrors;
        options.MaximumReceiveMessageSize           = _hubOptions.MaximumReceiveMessageSize;
        options.StreamBufferCapacity                = _hubOptions.StreamBufferCapacity;
        options.MaximumParallelInvocationsPerClient = _hubOptions.MaximumParallelInvocationsPerClient;

        options.UserHasSetValues = true;

        if (_hubOptions.HubFilters != null)
        {
            options.HubFilters = new List <IHubFilter>(_hubOptions.HubFilters);
        }
    }
Esempio n. 13
0
 public EnvelopeHub(
     Channel <ITransport> transportChannel,
     ConcurrentDictionary <string, Channel <string> > clientChannels,
     IEnvelopeSerializer envelopeSerializer,
     IHubContext <EnvelopeHub> hubContext,
     HubOptions hubOptions,
     HttpConnectionDispatcherOptions httpConnectionDispatcherOptions,
     EnvelopeHubOptions envelopeHubOptions,
     ITraceWriter traceWriter = null)
 {
     _transportChannel   = transportChannel;
     _clientChannels     = clientChannels;
     _traceWriter        = traceWriter;
     _envelopeSerializer = envelopeSerializer;
     _hubContext         = hubContext;
     _hubOptions         = hubOptions;
     _httpConnectionDispatcherOptions = httpConnectionDispatcherOptions;
     _envelopeHubOptions = envelopeHubOptions;
 }
Esempio n. 14
0
    private void InitNetwork()
    {
        // Set up optional options
        HubOptions options = new HubOptions();

        options.SkipNegotiation = false;

        // Crete the HubConnection
        hub = new HubConnection(URI, new JsonProtocol(new LitJsonEncoder()), options);

        hub.OnConnected += Hub_OnConnected;
        hub.OnError     += Hub_OnError;
        hub.OnClosed    += Hub_OnClosed;

        hub.OnMessage += Hub_OnMessage;

        hub.On("ReceiveMessage", (string user, string msg) => { Debug.Log(string.Format("{0},{1}", user, msg)); });

        hub.StartConnect();
    }
Esempio n. 15
0
        void Start()
        {
            HubOptions options = new HubOptions();

            options.SkipNegotiation = true;

            // Crete the HubConnection
            hub = new HubConnection(URI, new JsonProtocol(new LitJsonEncoder()), options);

            // Subscribe to hub events
            hub.OnConnected += Hub_OnConnected;
            hub.OnError     += Hub_OnError;
            hub.OnClosed    += Hub_OnClosed;

            hub.OnMessage += Hub_OnMessage;

            hub.OnRedirected += Hub_Redirected;

            // And finally start to connect to the server
            hub.StartConnect();

            uiText = "StartConnect called\n";
        }
Esempio n. 16
0
        public void OnConnectButton()
        {
            HubOptions options = new HubOptions();

            options.SkipNegotiation = true;

            // Crete the HubConnection
            hub = new HubConnection(new Uri(base.sampleSelector.BaseURL + this._path), new JsonProtocol(new LitJsonEncoder()), options);

            // Subscribe to hub events
            hub.OnConnected += Hub_OnConnected;
            hub.OnError     += Hub_OnError;
            hub.OnClosed    += Hub_OnClosed;

            hub.OnRedirected += Hub_Redirected;

            // And finally start to connect to the server
            hub.StartConnect();

            AddText("StartConnect called");

            SetButtons(false, false);
        }
Esempio n. 17
0
        public HubProxyHandler(
            HubLifetimeManager <Hub> lifetimeManager,
            IHubProtocolResolver protocolResolver,
            IOptions <HubOptions> globalHubOptions,
            IOptions <HubOptions <Hub> > hubOptions,
            ILoggerFactory loggerFactory,
            IUserIdProvider userIdProvider,
            IServiceScopeFactory serviceScopeFactory,
            IHubProxyInvoker rest)
            : base(lifetimeManager, protocolResolver, globalHubOptions, hubOptions, loggerFactory, userIdProvider, serviceScopeFactory)
        {
            _protocolResolver = protocolResolver;
            _lifetimeManager  = lifetimeManager;
            _loggerFactory    = loggerFactory;
            _hubOptions       = hubOptions.Value;
            _globalHubOptions = globalHubOptions.Value;
            _logger           = loggerFactory.CreateLogger <HubConnectionHandler <Hub> >();
            _userIdProvider   = userIdProvider;
            _rest             = rest;

            _enableDetailedErrors = false;
            _maximumMessageSize   = _globalHubOptions.MaximumReceiveMessageSize;
            _enableDetailedErrors = _globalHubOptions.EnableDetailedErrors ?? _enableDetailedErrors;
        }
Esempio n. 18
0
        public HubProxyHandler(
            IOptionsMonitor <UpstreamOptions> upstreamSettings,
            HubLifetimeManager <THub> lifetimeManager,
            IHubProtocolResolver protocolResolver,
            IOptions <HubOptions> globalHubOptions,
            IOptions <HubOptions <THub> > hubOptions,
            ILoggerFactory loggerFactory,
            IUserIdProvider userIdProvider,
            IServiceScopeFactory serviceScopeFactory,
            HttpServerlessMessageHandler <THub> upstream)
            : base(lifetimeManager, protocolResolver, globalHubOptions, hubOptions, loggerFactory, userIdProvider, serviceScopeFactory)
        {
            _protocolResolver = protocolResolver;
            _upstreamSettings = upstreamSettings;
            _lifetimeManager  = lifetimeManager;
            _loggerFactory    = loggerFactory;
            _hubOptions       = hubOptions.Value;
            _globalHubOptions = globalHubOptions.Value;
            _logger           = loggerFactory.CreateLogger <HubConnectionHandler <THub> >();
            _userIdProvider   = userIdProvider;
            _upstream         = upstream;

            _enableDetailedErrors = true;
        }
Esempio n. 19
0
 private void HubOpts(HubOptions opts)
 {
     opts.ClientTimeoutInterval = TimeSpan.FromSeconds(5);
     opts.HandshakeTimeout      = TimeSpan.FromSeconds(5);
 }
Esempio n. 20
0
    /// <summary>
    /// Adds an <see cref="IHubFilter"/> type to the <see cref="HubOptions"/> that will be resolved via DI or type activated.
    /// </summary>
    /// <typeparam name="TFilter">The <see cref="IHubFilter"/> type that will be added to the options.</typeparam>
    /// <param name="options">The options to add a filter to.</param>
    public static void AddFilter <[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFilter>(this HubOptions options) where TFilter : IHubFilter
    {
        _ = options ?? throw new ArgumentNullException(nameof(options));

        options.AddFilter(typeof(TFilter));
    }
Esempio n. 21
0
        private IHost BuildWebHost(
            IEnvelopeSerializer envelopeSerializer,
            X509Certificate2 tlsCertificate,
            int bufferSize,
            ITraceWriter traceWriter,
            HttpProtocols httpProtocols,
            SslProtocols sslProtocols,
            Func <X509Certificate2, X509Chain, SslPolicyErrors, bool> clientCertificateValidationCallback,
            TimeSpan?keepAliveInterval)
        {
            HttpConnectionDispatcherOptions httpConnectionDispatcherOptions = null;
            HubOptions hubOptions = null;

            return(Host.CreateDefaultBuilder()
                   .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseKestrel(serverOptions =>
                {
                    foreach (var listenerUri in ListenerUris)
                    {
                        if (!IPAddress.TryParse(listenerUri.Host, out var ipAddress))
                        {
                            ipAddress = IPAddress.Any;
                        }

                        var endPoint = new IPEndPoint(ipAddress, listenerUri.Port);
                        serverOptions.Listen(endPoint, listenOptions =>
                        {
                            listenOptions.Protocols = httpProtocols;

                            if (listenerUri.Scheme == Uri.UriSchemeHttps)
                            {
                                listenOptions.UseHttps(tlsCertificate, httpsOptions =>
                                {
                                    httpsOptions.SslProtocols = sslProtocols;
                                    httpsOptions.ClientCertificateValidation = clientCertificateValidationCallback;
                                });
                            }
                        });
                    }

                    serverOptions.AddServerHeader = false;
                })
                .SuppressStatusMessages(true)
                .ConfigureServices(services =>
                {
                    services
                    .AddLogging()
                    .AddSingleton(sp => _transportChannel)
                    .AddSingleton(sp => httpConnectionDispatcherOptions)
                    .AddSingleton(sp => hubOptions)
                    .AddSingleton(envelopeSerializer)
                    .AddSingleton(new EnvelopeHubOptions {
                        BoundedCapacity = _backpressureLimit
                    })
                    .AddSingleton(new ConcurrentDictionary <string, Channel <string> >())
                    .AddSignalR().AddHubOptions <EnvelopeHub>(options =>
                    {
                        hubOptions = options;
                        options.KeepAliveInterval = keepAliveInterval;
                    });

                    if (traceWriter != null)
                    {
                        services.AddSingleton(traceWriter);
                    }
                })
                .Configure(app =>
                {
                    app.UseRouting().UseEndpoints(endpoints =>
                    {
                        endpoints.MapHub <EnvelopeHub>("/envelope", options =>
                        {
                            httpConnectionDispatcherOptions = options;
                            options.TransportMaxBufferSize = bufferSize;
                        });
                    });
                });
            })
                   .Build());
        }
Esempio n. 22
0
 private void ConfigureSignalR(HubOptions hubOptions)
 {
     hubOptions.EnableDetailedErrors = true;
 }
Esempio n. 23
0
    //I use event functions because awaiting returns hubconn and this is useless
    public void ConnectToServer(string fbigToken        = null, string huaweiAuthCode = null,
                                string facebookAccToken = null, string name           = null, string pictureUrl = null,
                                bool demo = false)
    {
        Debug.Log("connecting to server");

        var query = HttpUtility.ParseQueryString(string.Empty);

        if (facebookAccToken != null)
        {
            query["fb_access_token"] = facebookAccToken;
        }

        if (fbigToken != null)
        {
            query["access_token"] = fbigToken;
        }

        if (huaweiAuthCode != null)
        {
            query["huaweiAuthCode"] = huaweiAuthCode;
        }

        if (name != null)
        {
            query["name"] = name;
        }
        if (pictureUrl != null)
        {
            query["pictureUrl"] = pictureUrl;
        }

        if (demo)
        {
            query["demo"] = "1";
        }


        var uriBuilder = new UriBuilder(getAddress())
        {
            Query = query.ToString()
        };

        Debug.Log($"connecting with url {uriBuilder.ToString()}");

        var hubOptions = new HubOptions()
        {
            SkipNegotiation   = true,
            PreferedTransport = TransportTypes.WebSocket,
        };

        hubConnection = new HubConnection(uriBuilder.Uri, protocol, hubOptions)
        {
            ReconnectPolicy = myReconnectPolicy,
        };

        // AssignGeneralRpcs();

        //I don't have this term "authentication" despite I make token authentication
        // HubConnection.AuthenticationProvider = new DefaultAccessTokenAuthenticator(HubConnection);

        hubConnection.OnConnected    += OnConnected;
        hubConnection.OnError        += OnError;
        hubConnection.OnClosed       += OnClosed;
        hubConnection.OnMessage      += OnMessage;
        hubConnection.OnReconnecting += OnReconnecting;

        BlockingOperationManager.I.Forget(hubConnection.ConnectAsync().AsUniTask());
    }
Esempio n. 24
0
    public Connection(ILogger <Connection> logger, HubOptions options)
    {
        _logger = logger;

        Url = options.Url;
    }
Esempio n. 25
0
 public HubOptionsSetup(IOptions <HubOptions> options)
 {
     _hubOptions = options.Value;
 }
Esempio n. 26
0
 public void Configure(HubOptions <THub> options)
 {
     options.SupportedProtocols = _hubOptions.SupportedProtocols;
     options.KeepAliveInterval  = _hubOptions.KeepAliveInterval;
     options.HandshakeTimeout   = _hubOptions.HandshakeTimeout;
 }