Exemplo n.º 1
0
 private ValueTask <IClientConnection> ResolveTargetConnectionAsync(
     IProvidedMethodReference method,
     IClientConnection source)
 {
     if (method.ProvidedService.ConnectionId.HasValue)
     {
         var connectionId = method.ProvidedService.ConnectionId.Value;
         if (!_clientConnectionTracker.TryGetOnlineConnection(connectionId, out var connection))
         {
             throw new InvalidOperationException($"The requested connection {connectionId} is not online");
         }
         return(new ValueTask <IClientConnection>(connection));
     }
     return(_clientConnectionTracker.GetOrSpawnConnectionAsync(new[] { method.ProvidedService.ApplicationId }));
 }