Базово работает
gRPC на отдельном порту
This commit is contained in:
@@ -15,7 +15,19 @@ public sealed class GrpcSmsClient : ISmsClient, IDisposable
|
||||
|
||||
public GrpcSmsClient(GrpcSmsClientOptions options)
|
||||
{
|
||||
_channel = GrpcChannel.ForAddress(options.Address);
|
||||
var address = options.Address;
|
||||
var channelOptions = new GrpcChannelOptions();
|
||||
|
||||
if (address.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
|
||||
channelOptions.HttpHandler = new SocketsHttpHandler
|
||||
{
|
||||
EnableMultipleHttp2Connections = true,
|
||||
};
|
||||
}
|
||||
|
||||
_channel = GrpcChannel.ForAddress(address, channelOptions);
|
||||
_client = new SmsTestService.SmsTestServiceClient(_channel);
|
||||
}
|
||||
|
||||
@@ -58,14 +70,12 @@ public sealed class GrpcSmsClient : ISmsClient, IDisposable
|
||||
_channel.Dispose();
|
||||
}
|
||||
|
||||
private static Dish ToDish(MenuItem item) => new()
|
||||
{
|
||||
Id = item.Id,
|
||||
Article = item.Article,
|
||||
Name = item.Name,
|
||||
Price = (decimal)item.Price,
|
||||
IsWeighted = item.IsWeighted,
|
||||
FullPath = item.FullPath,
|
||||
Barcodes = item.Barcodes.ToList(),
|
||||
};
|
||||
private static Dish ToDish(MenuItem item) => new(
|
||||
item.Id,
|
||||
item.Article,
|
||||
item.Name,
|
||||
(decimal)item.Price,
|
||||
item.IsWeighted,
|
||||
item.FullPath,
|
||||
item.Barcodes.ToList());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user