title: GRPC async response stream C#
body: <p>How would I generate streaming response values for an RPC from outside the handler? (specifically, from a IObservable) I'm currently doing the following, but this is creating cross-thread issues because <code>AnRxObservable</code> is shared between RPC handlers...</p>
  
  <pre><code>public override Task GetTicker(RequestProto request, ServerCallContext context)
  {
      var subscription = AnRxObservable.Subscribe(value =&gt;
      {
          responseStream.WriteAsync(new ResponseProto
          {
              Value = value
          });
      });
  
      // Wait for the RPC to be canceled (my extension method
      // that returns a task that completes when the CancellationToken
      // is cancelled)
      await context.CancellationToken.WhenCancelled();
  
      // Dispose of the buffered stream
      bufferedStream.Dispose();
  
      // Dispose subscriber (tells rx that we aren't subscribed anymore)
      subscription.Dispose();
  
      return Task.FromResult(1);
  }
  </code></pre>
  
  <p>This code doesn't feel right... but I can't see any other way of streaming RPC responses from a shared source created outside the RPC handler.</p>