Skip to content

Instantly share code, notes, and snippets.

@tocalai
Created July 12, 2019 03:02
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 tocalai/3b56ab703adbcc650663ce0cd92bcbec to your computer and use it in GitHub Desktop.
Save tocalai/3b56ab703adbcc650663ce0cd92bcbec to your computer and use it in GitHub Desktop.
Grpc client application entry point.
class Program
{
static void Main(string[] args)
{
// same host and port setting as server side
var host = "127.0.0.1";
var port = 50052;
var channel = new Channel($"{host}:{port}", ChannelCredentials.Insecure);
var client = new AlertService.AlertServiceClient(channel);
// fire request to server
var result = client.SendAlert(new AlertRequest()
{
Type = 1,
Uid = Guid.NewGuid().ToString(),
MsgValue = "Tesing alert message",
Severity = 0,
DateTime = Timestamp.FromDateTime(DateTime.Now.ToUniversalTime())
});
// receive response and print out
Console.WriteLine($"[Alert Response], Ack = {result.Ack}, Stat = {result.ReturnCode}.");
channel.ShutdownAsync().Wait();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment