/// <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 = _hubOptions.EnableDetailedErrors ?? _globalHubOptions.EnableDetailedErrors ?? false; _maximumMessageSize = _hubOptions.MaximumReceiveMessageSize ?? _globalHubOptions.MaximumReceiveMessageSize; _dispatcher = new DefaultHubDispatcher <THub>( serviceScopeFactory, new HubContext <THub>(lifetimeManager), hubOptions, globalHubOptions, new Logger <DefaultHubDispatcher <THub> >(loggerFactory)); }
public HubEndPoint(HubLifetimeManager <THub> lifetimeManager, IHubContext <THub> hubContext, InvocationAdapterRegistry registry, ILogger <HubEndPoint <THub> > logger, IServiceScopeFactory serviceScopeFactory) : base(lifetimeManager, hubContext, registry, logger, serviceScopeFactory) { }
public HubContext(HubLifetimeManager <THub> lifetimeManager) { _lifetimeManager = lifetimeManager; All = TypedClientBuilder <T> .Build(new AllClientProxy <THub>(_lifetimeManager)); Groups = new GroupManager <THub>(lifetimeManager); }
private static async Task InvokeConnectionAsync(HubLifetimeManager <ClientHub> clientHubManager, HubMethodInvocationMessage message) { if (message.TryGetConnectionId(out var connectionId)) { await clientHubManager.InvokeConnectionAsync(connectionId, message.Target, message.Arguments); } }
private static async Task RemoveGroupAsync(HubLifetimeManager <ClientHub> clientHubManager, HubMethodInvocationMessage message) { if (message.TryGetGroupName(out var groupName) && message.TryGetConnectionId(out var connectionId)) { await clientHubManager.RemoveGroupAsync(connectionId, groupName); } }
private static async Task InvokeGroupAsync(HubLifetimeManager <ClientHub> clientHubManager, HubMethodInvocationMessage message) { if (message.TryGetGroupName(out var groupName)) { await clientHubManager.InvokeGroupAsync(groupName, message.Target, message.Arguments); } }
private static async Task InvokeAllExceptAsync(HubLifetimeManager <ClientHub> clientHubManager, HubMethodInvocationMessage message) { if (message.TryGetExcludedIds(out var excludedIds)) { await clientHubManager.InvokeAllExceptAsync(message.Target, message.Arguments, excludedIds); } }
public HubServer(HubLifetimeManager <THub> lifetimeManager, IHubInvoker <THub> hubInvoker, ILoggerFactory loggerFactory) { _lifetimeManager = lifetimeManager; _hubInvoker = hubInvoker; _loggerFactory = loggerFactory; _logger = loggerFactory.CreateLogger <HubServer <THub> >(); }
/// <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; List <IHubFilter> hubFilters = null; if (_hubOptions.UserHasSetValues) { _maximumMessageSize = _hubOptions.MaximumReceiveMessageSize; _enableDetailedErrors = _hubOptions.EnableDetailedErrors ?? _enableDetailedErrors; if (_hubOptions.HubFilters != null) { hubFilters = new List <IHubFilter>(); hubFilters.AddRange(_hubOptions.HubFilters); } } else { _maximumMessageSize = _globalHubOptions.MaximumReceiveMessageSize; _enableDetailedErrors = _globalHubOptions.EnableDetailedErrors ?? _enableDetailedErrors; if (_globalHubOptions.HubFilters != null) { hubFilters = new List <IHubFilter>(); hubFilters.AddRange(_globalHubOptions.HubFilters); } } _dispatcher = new DefaultHubDispatcher <THub>( serviceScopeFactory, new HubContext <THub>(lifetimeManager), _enableDetailedErrors, new Logger <DefaultHubDispatcher <THub> >(loggerFactory), hubFilters); }
public HubEndPoint(HubLifetimeManager <THub> lifetimeManager, IHubProtocolResolver protocolResolver, IOptions <HubOptions> hubOptions, ILoggerFactory loggerFactory, IUserIdProvider userIdProvider, IHubInvoker <THub> hubInvoker) { _protocolResolver = protocolResolver; _lifetimeManager = lifetimeManager; _loggerFactory = loggerFactory; _hubOptions = hubOptions.Value; _logger = loggerFactory.CreateLogger <HubEndPoint <THub> >(); _userIdProvider = userIdProvider; _hubInvoker = hubInvoker; }
public HubEndPoint(HubLifetimeManager <THub> lifetimeManager, IHubProtocolResolver protocolResolver, IHubContext <THub> hubContext, IOptions <HubOptions> hubOptions, ILogger <HubEndPoint <THub> > logger, IServiceScopeFactory serviceScopeFactory) { _protocolResolver = protocolResolver; _lifetimeManager = lifetimeManager; _hubContext = hubContext; _hubOptions = hubOptions; _logger = logger; _serviceScopeFactory = serviceScopeFactory; DiscoverHubMethods(); }
public HubEndPoint(HubLifetimeManager <THub> lifetimeManager, IHubProtocolResolver protocolResolver, IOptions <HubOptions> globalHubOptions, IOptions <HubOptions <THub> > hubOptions, ILoggerFactory loggerFactory, IUserIdProvider userIdProvider, HubDispatcher <THub> dispatcher) { _protocolResolver = protocolResolver; _lifetimeManager = lifetimeManager; _loggerFactory = loggerFactory; _hubOptions = hubOptions.Value; _globalHubOptions = globalHubOptions.Value; _logger = loggerFactory.CreateLogger <HubEndPoint <THub> >(); _userIdProvider = userIdProvider; _dispatcher = dispatcher; }
public HubConnectionHandler(HubLifetimeManager <THub> lifetimeManager, IHubProtocolResolver protocolResolver, IOptions <HubOptions> globalHubOptions, IOptions <HubOptions <THub> > hubOptions, ILoggerFactory loggerFactory, IUserIdProvider userIdProvider, HubDispatcher <THub> dispatcher) { _protocolResolver = protocolResolver; _lifetimeManager = lifetimeManager; _loggerFactory = loggerFactory; _hubOptions = hubOptions.Value; _globalHubOptions = globalHubOptions.Value; _logger = loggerFactory.CreateLogger <HubConnectionHandler <THub> >(); _userIdProvider = userIdProvider; _dispatcher = dispatcher; _enableDetailedErrors = _hubOptions.EnableDetailedErrors ?? _globalHubOptions.EnableDetailedErrors ?? false; }
public ServiceConnection(IConnection connection, IHubProtocol protocol, HubLifetimeManager <THub> lifetimeManager, IHubInvoker <THub> hubInvoker, ILoggerFactory loggerFactory) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _protocol = protocol ?? throw new ArgumentNullException(nameof(protocol)); _loggerFactory = loggerFactory ?? NullLoggerFactory.Instance; _logger = _loggerFactory.CreateLogger <ServiceConnection <THub> >(); _hubInvoker = hubInvoker; _lifetimeManager = lifetimeManager; _output = Channel.CreateUnbounded <HubMessage>(); // Create the timer for timeout, but disabled by default (we enable it when started). _timeoutTimer = new Timer(state => ((ServiceConnection <THub>)state).TimeoutElapsed(), this, Timeout.Infinite, Timeout.Infinite); connection.OnReceived((data, state) => ((ServiceConnection <THub>)state).OnDataReceivedAsync(data), this); }
public HubEndPoint(HubLifetimeManager <THub> lifetimeManager, IHubProtocolResolver protocolResolver, IHubContext <THub> hubContext, IOptions <HubOptions> hubOptions, ILoggerFactory loggerFactory, IServiceScopeFactory serviceScopeFactory, IUserIdProvider userIdProvider) { _protocolResolver = protocolResolver; _lifetimeManager = lifetimeManager; _hubContext = hubContext; _loggerFactory = loggerFactory; _hubOptions = hubOptions.Value; _logger = loggerFactory.CreateLogger <HubEndPoint <THub> >(); _serviceScopeFactory = serviceScopeFactory; _userIdProvider = userIdProvider; DiscoverHubMethods(); }
/// <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="dispatcher">The hub dispatcher used to dispatch incoming messages to hubs.</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, #pragma warning disable PUB0001 // Pubternal type in public API HubDispatcher <THub> dispatcher #pragma warning restore PUB0001 ) { _protocolResolver = protocolResolver; _lifetimeManager = lifetimeManager; _loggerFactory = loggerFactory; _hubOptions = hubOptions.Value; _globalHubOptions = globalHubOptions.Value; _logger = loggerFactory.CreateLogger <HubConnectionHandler <THub> >(); _userIdProvider = userIdProvider; _dispatcher = dispatcher; _enableDetailedErrors = _hubOptions.EnableDetailedErrors ?? _globalHubOptions.EnableDetailedErrors ?? false; }
public AllClientProxy(HubLifetimeManager <THub> lifetimeManager) { _lifetimeManager = lifetimeManager; }
public GroupExceptProxy(HubLifetimeManager <THub> lifetimeManager, string groupName, IReadOnlyList <string> excludedIds) { _lifetimeManager = lifetimeManager; _groupName = groupName; _excludedIds = excludedIds; }
public MultipleGroupProxy(HubLifetimeManager <THub> lifetimeManager, IReadOnlyList <string> groupNames) { _lifetimeManager = lifetimeManager; _groupNames = groupNames; }
public GroupProxy(HubLifetimeManager <THub> lifetimeManager, string groupName) { _lifetimeManager = lifetimeManager; _groupName = groupName; }
public MultipleUserProxy(HubLifetimeManager <THub> lifetimeManager, IReadOnlyList <string> userIds) { _lifetimeManager = lifetimeManager; _userIds = userIds; }
public GroupManager(HubLifetimeManager <THub> lifetimeManager) { _lifetimeManager = lifetimeManager; }
public MultipleClientProxy(HubLifetimeManager <THub> lifetimeManager, IReadOnlyList <string> connectionIds) { _lifetimeManager = lifetimeManager; _connectionIds = connectionIds; }
public SingleClientProxy(HubLifetimeManager <THub> lifetimeManager, string connectionId) { _lifetimeManager = lifetimeManager; _connectionId = connectionId; }
public UserProxy(HubLifetimeManager <THub> lifetimeManager, string userId) { _lifetimeManager = lifetimeManager; _userId = userId; }
public AllClientsExceptProxy(HubLifetimeManager <THub> lifetimeManager, IReadOnlyList <string> excludedIds) { _lifetimeManager = lifetimeManager; _excludedIds = excludedIds; }
public HubContext(HubLifetimeManager <THub> lifetimeManager) { _lifetimeManager = lifetimeManager; _clients = new HubClients <THub, T>(_lifetimeManager); Groups = new GroupManager <THub>(lifetimeManager); }
public HubClients(HubLifetimeManager <THub> lifetimeManager) { _lifetimeManager = lifetimeManager; All = TypedClientBuilder <T> .Build(new AllClientProxy <THub>(_lifetimeManager)); }
private static async Task InvokeAllAsync(HubLifetimeManager <ClientHub> clientHubManager, HubMethodInvocationMessage message) { await clientHubManager.InvokeAllAsync(message.Target, message.Arguments); }
public HubClients(HubLifetimeManager <THub> lifetimeManager) { _lifetimeManager = lifetimeManager; All = new AllClientProxy <THub>(_lifetimeManager); }