Skip to content

Instantly share code, notes, and snippets.

@AurelianTactics
Created January 26, 2022 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AurelianTactics/b4a9e29c429bf07ae2335d6d9ee0fa3a to your computer and use it in GitHub Desktop.
Save AurelianTactics/b4a9e29c429bf07ae2335d6d9ee0fa3a to your computer and use it in GitHub Desktop.
BasicEnvWithGRPC DmEnvRpcImpl.cs
//requests and responses are a bidirection gRPC stream.
while (await requestStream.MoveNext())
{
// A request is received
EnvironmentRequest envRequest = requestStream.Current;
// add the request to the RequestQUeu
this.requestQueue.AddRequestQueueObject(envRequest);
// ask the session layer to do its work and generate a reponse to send to the client
var envResponseList = await this.agentSession.HandleEnvironmentRequest();
foreach (DmEnvRpc.V1.EnvironmentResponse ero in envResponseList)
{
// send a response to the client
await responseStream.WriteAsync(ero);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment