Ejemplo n.º 1
0
        private void OnAccepted(HubId remoteHubId, Connection connection, BeforeChannelAccepted before, AfterChannelAccepted after)
        {
            var channelId = new ChannelId(_hubOptions.HubId, remoteHubId);

            Channel channel = _channels.GetOrAdd(channelId, id => new Channel(before(id.Remote), _hubOptions.LoggerFactory)
            {
                RemoteHubId = remoteHubId
            });

            _remoteIndex.TryAdd(remoteHubId, channel);
            after(channelId, channel);

            channel.OnReconnect(connection);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initialized a new instance of <see cref="ServerOptions" /> class
 /// </summary>
 /// <param name="uri">An uri to listen at</param>
 /// <param name="before">Action that is invoked before a channel accepted.</param>
 /// <param name="after">An action that is invoked after channel is created.</param>
 public ServerOptions(Uri uri, BeforeChannelAccepted before, AfterChannelAccepted after)
 {
     Uri    = uri ?? throw new ArgumentNullException(nameof(uri));
     Before = before ?? throw new ArgumentNullException(nameof(before));
     After  = after ?? throw new ArgumentNullException(nameof(after));
 }