コード例 #1
0
 public override void Init(IDependencyResolver resolver)
 {
     _manager         = resolver.GetService <IHubManager>();
     _activator       = resolver.GetService <IHubActivator>();
     _pipelineInvoker = resolver.GetService <IHubPipelineInvoker>();
     base.Init(resolver);
 }
コード例 #2
0
 public HubConnectionContextBase(string hubName, IConnection connection, IHubPipelineInvoker invoker)
 {
     HubName    = hubName;
     Connection = connection;
     Invoker    = invoker;
     Current    = new ConnectionProxy(hubName, connection, invoker);
 }
 public ClientProxy(IConnection connection, IHubPipelineInvoker invoker, string hubName, IList<string> exclude)
 {
     _connection = connection;
     _invoker = invoker;
     _hubName = hubName;
     _exclude = exclude;
     _signal = PrefixHelper.GetHubName(_hubName);
 }
コード例 #4
0
 protected SignalProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName, string prefix, IList <string> exclude)
 {
     Connection = connection;
     Invoker    = invoker;
     HubName    = hubName;
     Signal     = prefix + hubName + "." + signal;
     _exclude   = exclude;
 }
コード例 #5
0
ファイル: SignalProxy.cs プロジェクト: eduaglz/SignalR-Server
 protected SignalProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName, string prefix, IList<string> exclude)
 {
     Connection = connection;
     Invoker = invoker;
     HubName = hubName;
     Signal = prefix + hubName + "." + signal;
     _exclude = exclude;
 }
コード例 #6
0
        public HubConnectionContextBase(IConnection connection, IHubPipelineInvoker invoker, string hubName)
        {
            Connection = connection;
            Invoker    = invoker;
            HubName    = hubName;

            All = AllExcept();
        }
コード例 #7
0
 public MultipleSignalProxy(IConnection connection, IHubPipelineInvoker invoker, IList<string> signals, string hubName, string prefix, IList<string> exclude)
 {
     _connection = connection;
     _invoker = invoker;
     _hubName = hubName;
     _signals = signals.Select(signal => prefix + _hubName + "." + signal).ToList();
     _exclude = exclude;
 }
コード例 #8
0
 public MultipleSignalProxy(IConnection connection, IHubPipelineInvoker invoker, IList <string> signals, string hubName, string prefix, IList <string> exclude)
 {
     _connection = connection;
     _invoker    = invoker;
     _hubName    = hubName;
     _signals    = signals.Select(signal => prefix + _hubName + "." + signal).ToList();
     _exclude    = exclude;
 }
コード例 #9
0
 public ClientProxy(IConnection connection, IHubPipelineInvoker invoker, string hubName, IList <string> exclude)
 {
     _connection = connection;
     _invoker    = invoker;
     _hubName    = hubName;
     _exclude    = exclude;
     _signal     = PrefixHelper.GetHubName(_hubName);
 }
コード例 #10
0
        public HubConnectionContextBase(IConnection connection, IHubPipelineInvoker invoker, string hubName)
        {
            Connection = connection;
            Invoker = invoker;
            HubName = hubName;

            All = AllExcept();
        }
コード例 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HubConnectionContext"/>.
        /// </summary>
        /// <param name="pipelineInvoker">The pipeline invoker.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="hubName">The hub name.</param>
        /// <param name="connectionId">The connection id.</param>
        /// <param name="tracker">The connection hub state.</param>
        public HubConnectionContext(IHubPipelineInvoker pipelineInvoker, IConnection connection, string hubName, string connectionId, StateChangeTracker tracker)
            : base(connection, pipelineInvoker, hubName)
        {
            _connectionId = connectionId;

            Caller = new StatefulSignalProxy(connection, pipelineInvoker, connectionId, PrefixHelper.HubConnectionIdPrefix, hubName, tracker);
            All = AllExcept();
            Others = AllExcept(connectionId);
        }
コード例 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HubConnectionContext"/>.
        /// </summary>
        /// <param name="pipelineInvoker">The pipeline invoker.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="hubName">The hub name.</param>
        /// <param name="connectionId">The connection id.</param>
        /// <param name="tracker">The connection hub state.</param>
        public HubConnectionContext(IHubPipelineInvoker pipelineInvoker, IConnection connection, string hubName, string connectionId, StateChangeTracker tracker)
            : base(connection, pipelineInvoker, hubName)
        {
            _connectionId = connectionId;

            Caller = new StatefulSignalProxy(connection, pipelineInvoker, connectionId, PrefixHelper.HubConnectionIdPrefix, hubName, tracker);
            All    = AllExcept();
            Others = AllExcept(connectionId);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HubConnectionContext"/>.
        /// </summary>
        /// <param name="pipelineInvoker">The pipeline invoker.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="hubName">The hub name.</param>
        /// <param name="connectionId">The connection id.</param>
        public HubConnectionContext(IHubPipelineInvoker pipelineInvoker, IConnection connection, string hubName, string connectionId)
            : base(connection, pipelineInvoker, hubName)
        {
            _connectionId = connectionId;

            Caller = new SignalProxy(connection, pipelineInvoker, connectionId, hubName, PrefixHelper.HubConnectionIdPrefix, ListHelper <string> .Empty);
            All    = AllExcept();
            Others = AllExcept(connectionId);
        }
コード例 #14
0
ファイル: HubConnectionContext.cs プロジェクト: Gadarr/Gadarr
        /// <summary>
        /// Initializes a new instance of the <see cref="HubConnectionContext"/>.
        /// </summary>
        /// <param name="pipelineInvoker">The pipeline invoker.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="hubName">The hub name.</param>
        /// <param name="connectionId">The connection id.</param>
        /// <param name="tracker">The connection hub state.</param>
        public HubConnectionContext(IHubPipelineInvoker pipelineInvoker, IConnection connection, string hubName, string connectionId, StateChangeTracker tracker)
        {
            _send         = (signal, invocation, exclude) => pipelineInvoker.Send(new HubOutgoingInvokerContext(connection, signal, invocation, exclude));
            _connectionId = connectionId;
            _hubName      = hubName;

            Caller = new StatefulSignalProxy(_send, connectionId, PrefixHelper.HubConnectionIdPrefix, hubName, tracker);
            All    = AllExcept();
            Others = AllExcept(connectionId);
        }
コード例 #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HubConnectionContext"/>.
        /// </summary>
        /// <param name="pipelineInvoker">The pipeline invoker.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="hubName">The hub name.</param>
        /// <param name="connectionId">The connection id.</param>
        /// <param name="tracker">The connection hub state.</param>
        public HubConnectionContext(IHubPipelineInvoker pipelineInvoker, IConnection connection, string hubName, string connectionId, StateChangeTracker tracker)
        {
            _send = (signal, invocation, exclude) => pipelineInvoker.Send(new HubOutgoingInvokerContext(connection, signal, invocation, exclude));
            _connectionId = connectionId;
            _hubName = hubName;

            Caller = new StatefulSignalProxy(_send, connectionId, PrefixHelper.HubConnectionIdPrefix, hubName, tracker);
            All = AllExcept();
            Others = AllExcept(connectionId);
        }
コード例 #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HubConnectionContext"/>.
        /// </summary>
        /// <param name="pipelineInvoker">The pipeline invoker.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="hubName">The hub name.</param>
        /// <param name="connectionId">The connection id.</param>
        /// <param name="state">The connection hub state.</param>
        public HubConnectionContext(IHubPipelineInvoker pipelineInvoker, IConnection connection, string hubName, string connectionId, TrackingDictionary state)
        {
            _send         = (signal, invocation, exclude) => pipelineInvoker.Send(new HubOutgoingInvokerContext(connection, signal, invocation, exclude));
            _connectionId = connectionId;
            _hubName      = hubName;

            Caller = new StatefulSignalProxy(_send, connectionId, hubName, state);
            All    = AllExcept();
            Others = AllExcept(connectionId);
        }
コード例 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HubConnectionContext"/>.
        /// </summary>
        /// <param name="pipelineInvoker">The pipeline invoker.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="hubName">The hub name.</param>
        /// <param name="connectionId">The connection id.</param>
        /// <param name="state">The connection hub state.</param>
        public HubConnectionContext(IHubPipelineInvoker pipelineInvoker, IConnection connection, string hubName, string connectionId, TrackingDictionary state)
        {
            _send = (signal, invocation, exclude) => pipelineInvoker.Send(new HubOutgoingInvokerContext(connection, signal, invocation, exclude));
            _connectionId = connectionId;
            _hubName = hubName;

            Caller = new StatefulSignalProxy(_send, connectionId, hubName, state);
            All = AllExcept();
            Others = AllExcept(connectionId);
        }
コード例 #18
0
        public override void Initialize(IDependencyResolver resolver, HostContext context)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _proxyGenerator  = resolver.Resolve <IJavaScriptProxyGenerator>();
            _manager         = resolver.Resolve <IHubManager>();
            _binder          = resolver.Resolve <IParameterResolver>();
            _requestParser   = resolver.Resolve <IHubRequestParser>();
            _pipelineInvoker = resolver.Resolve <IHubPipelineInvoker>();

            _counters = resolver.Resolve <IPerformanceCounterManager>();

            // Call base initializer before populating _hubs so the _jsonSerializer is initialized
            base.Initialize(resolver, context);

            // Populate _hubs
            string data = context.Request.QueryStringOrForm("connectionData");

            if (!String.IsNullOrEmpty(data))
            {
                var clientHubInfo = JsonSerializer.Parse <IEnumerable <ClientHubInfo> >(data);
                if (clientHubInfo != null)
                {
                    foreach (var hubInfo in clientHubInfo)
                    {
                        // Try to find the associated hub type
                        HubDescriptor hubDescriptor = _manager.EnsureHub(hubInfo.Name,
                                                                         _counters.ErrorsHubResolutionTotal,
                                                                         _counters.ErrorsHubResolutionPerSec,
                                                                         _counters.ErrorsAllTotal,
                                                                         _counters.ErrorsAllPerSec);

                        if (_pipelineInvoker.AuthorizeConnect(hubDescriptor, context.Request))
                        {
                            // Add this to the list of hub descriptors this connection is interested in
                            _hubs.Add(hubDescriptor);
                        }
                    }
                }
            }
        }
コード例 #19
0
        public override void Initialize(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            _proxyGenerator = _enableJavaScriptProxies ? serviceProvider.GetRequiredService <IJavaScriptProxyGenerator>()
                                                       : new EmptyJavaScriptProxyGenerator();

            _manager         = serviceProvider.GetRequiredService <IHubManager>();
            _binder          = serviceProvider.GetRequiredService <IParameterResolver>();
            _requestParser   = serviceProvider.GetRequiredService <IHubRequestParser>();
            _serializer      = serviceProvider.GetRequiredService <JsonSerializer>();
            _pipelineInvoker = serviceProvider.GetRequiredService <IHubPipelineInvoker>();
            _counters        = serviceProvider.GetRequiredService <IPerformanceCounterManager>();

            base.Initialize(serviceProvider);
        }
コード例 #20
0
ファイル: HubDispatcher.cs プロジェクト: ebt/SignalRSlim
        public override void Initialize(IDependencyResolver resolver)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            _proxyGenerator = _enableJavaScriptProxies ? resolver.Resolve <IJavaScriptProxyGenerator>()
                                                       : new EmptyJavaScriptProxyGenerator();

            _manager         = resolver.Resolve <IHubManager>();
            _binder          = resolver.Resolve <IParameterResolver>();
            _requestParser   = resolver.Resolve <IHubRequestParser>();
            _serializer      = resolver.Resolve <JsonSerializer>();
            _pipelineInvoker = resolver.Resolve <IHubPipelineInvoker>();
            _counters        = resolver.Resolve <IPerformanceCounterManager>();

            base.Initialize(resolver);
        }
コード例 #21
0
 public GroupProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName, IList <string> exclude) :
     base(connection, invoker, signal, hubName, PrefixHelper.HubGroupPrefix, exclude)
 {
 }
コード例 #22
0
 public ConnectionProxy(string hubName, IConnection connection, IHubPipelineInvoker invoker) : base(hubName, connection, invoker)
 {
 }
 public ConnectionIdProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName, params string[] exclude) :
     base(connection, invoker, signal, hubName, PrefixHelper.HubConnectionIdPrefix, exclude)
 { }
コード例 #24
0
ファイル: GroupProxy.cs プロジェクト: eduaglz/SignalR-Server
 public GroupProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName, IList<string> exclude)
     : base(connection, invoker, signal, hubName, PrefixHelper.HubGroupPrefix, exclude)
 {
 }
コード例 #25
0
 public UserProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName) :
     base(connection, invoker, signal, hubName, PrefixHelper.HubUserPrefix, ListHelper <string> .Empty)
 {
 }
コード例 #26
0
 public HubContext(IConnection connection, IHubPipelineInvoker invoker, string hubName)
 {
     Clients = new HubConnectionContextBase(connection, invoker, hubName);
     Groups = new GroupManager(connection, PrefixHelper.GetHubGroupName(hubName));
 }
コード例 #27
0
 public StatefulSignalProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName, string prefix, StateChangeTracker tracker)
     : base(connection, invoker, signal, prefix, hubName, ListHelper<string>.Empty)
 {
     _tracker = tracker;
 }
コード例 #28
0
 public StatefulSignalProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName, string prefix, StateChangeTracker tracker)
     : base(connection, invoker, signal, prefix, hubName, ListHelper <string> .Empty)
 {
     _tracker = tracker;
 }
コード例 #29
0
        public UserProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName) :
            base(connection, invoker, signal, hubName, PrefixHelper.HubUserPrefix, ListHelper<string>.Empty)
        {

        }
コード例 #30
0
 public HubContext(IConnection connection, IHubPipelineInvoker invoker, string hubName)
 {
     Clients = new HubConnectionContextBase(connection, invoker, hubName);
     Groups  = new GroupManager(connection, PrefixHelper.GetHubGroupName(hubName));
 }
コード例 #31
0
 public ConnectionIdProxy(IConnection connection, IHubPipelineInvoker invoker, string signal, string hubName, params string[] exclude) :
     base(connection, invoker, signal, hubName, PrefixHelper.HubConnectionIdPrefix, exclude)
 {
 }
コード例 #32
0
 public HubProxy(string hubName, IConnection connection, IHubPipelineInvoker invoker)
 {
     HubName    = hubName;
     Connection = connection;
     Invoker    = invoker;
 }