コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hub" /> class.
 /// </summary>
 /// <param name="hubLocation">The hub address.</param>
 /// <param name="subscriptionStore">The subscription store.</param>
 /// <param name="cryptoFunctions">The challenge generator.</param>
 public Hub(
     Uri hubLocation,
     ISubscriptionStore subscriptionStore,
     ICryptoFunctions cryptoFunctions)
     : this(hubLocation, subscriptionStore, cryptoFunctions, null, null)
 {
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Hub" /> class.
        /// </summary>
        /// <param name="hubLocation">The hub address.</param>
        /// <param name="subscriptionStore">The subscription store.</param>
        /// <param name="cryptoFunctions">The challenge generator.</param>
        /// <param name="queue">The queue.</param>
        /// <param name="messageHandler">The message handler.</param>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        public Hub(
            Uri hubLocation,
            ISubscriptionStore subscriptionStore,
            ICryptoFunctions cryptoFunctions,
            IPublishQueue queue,
            HttpMessageHandler messageHandler)
        {
            if (subscriptionStore == null)
            {
                throw new ArgumentNullException(nameof(subscriptionStore));
            }

            if (cryptoFunctions == null)
            {
                throw new ArgumentNullException(nameof(cryptoFunctions));
            }

            _hubLocation         = hubLocation;
            _subscriptionStore   = subscriptionStore;
            _cryptoFunctions     = cryptoFunctions;
            _notificationService = new NotificationService(this, queue ?? new InMemoryPublishQueue());

            _httpClient = messageHandler == null
                ? new HttpClient()
                : new HttpClient(messageHandler);

            _notificationService.Start();
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hub" /> class.
 /// </summary>
 /// <param name="hubLocation">The hub address.</param>
 /// <param name="subscriptionStore">The subscription store.</param>
 /// <param name="cryptoFunctions">The challenge generator.</param>
 /// <param name="queue">The queue.</param>
 public Hub(
     Uri hubLocation,
     ISubscriptionStore subscriptionStore,
     ICryptoFunctions cryptoFunctions,
     IPublishQueue queue)
     : this(hubLocation, subscriptionStore, cryptoFunctions, queue, null)
 {
 }