-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace WebSocketApp proj with GRPC*
Removed WebSocket project and added GRPC projects from RIM (copy&paste). Then removed unused stuff from GRPC* projects and specified package versions in Directory.Packages.props.
- Loading branch information
1 parent
33ce6fa
commit a8e60f8
Showing
21 changed files
with
213 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Google.Protobuf" /> | ||
<PackageReference Include="Grpc.Net.ClientFactory" /> | ||
<PackageReference Include="Grpc.Tools"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Protobuf Include="..\FX.GrpcService\Protos\fx.proto" GrpcServices="Client"> | ||
<Link>Protos\fx.proto</Link> | ||
</Protobuf> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
| ||
using System; | ||
using System.Threading.Tasks; | ||
using Grpc.Core; | ||
using Grpc.Net.Client; | ||
using GrpcService; | ||
|
||
namespace GrpcClient | ||
{ | ||
public class Instance | ||
{ | ||
private static string serverFqdn = | ||
"localhost"; | ||
|
||
public FXGrpcService.FXGrpcServiceClient Connect() | ||
{ | ||
var channel = GrpcChannel.ForAddress($"http://{serverFqdn}:8080"); | ||
var client = new FXGrpcService.FXGrpcServiceClient(channel); | ||
return client; | ||
} | ||
|
||
public async Task<string> SendMessage(string message) | ||
{ | ||
var client = Connect(); | ||
var reply = await client.GenericMethodAsync( | ||
new GenericInputParam { MsgIn = "hello" } | ||
); | ||
Console.WriteLine($"Got response: {reply.MsgOut}"); | ||
|
||
return reply.MsgOut; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Protobuf Include="Protos\fx.proto" GrpcServices="Server" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Grpc.AspNetCore" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using GrpcService; | ||
using GrpcService.Services; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// Additional configuration is required to successfully run gRPC on macOS. | ||
// For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682 | ||
|
||
// Add services to the container. | ||
|
||
builder.Configuration | ||
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory) | ||
.AddJsonFile("appsettings.json", false, true); | ||
|
||
builder.Services.AddGrpc(); | ||
|
||
var app = builder.Build(); | ||
|
||
|
||
#if !DEBUG | ||
app.Urls.Add("http://*:8080"); | ||
#endif | ||
|
||
// Configure the HTTP request pipeline. | ||
app.MapGrpcService<FXService>(); | ||
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909"); | ||
|
||
app.Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"profiles": { | ||
"GrpcService": { | ||
"commandName": "Project", | ||
"applicationUrl": "http://localhost:5178;https://localhost:7178", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"dotnetRunMessages": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
syntax = "proto3"; | ||
|
||
option csharp_namespace = "GrpcService"; | ||
|
||
package fx; | ||
|
||
// The greeting service definition. | ||
service FXGrpcService { | ||
// Sends a greeting | ||
rpc GenericMethod (GenericInputParam) returns (GenericOutputParam); | ||
|
||
rpc GenericStreamOutputMethod (GenericInputParam) returns (stream GenericOutputParam); | ||
} | ||
|
||
// The request message containing the user's name. | ||
message GenericInputParam { | ||
string msgIn = 1; | ||
} | ||
|
||
// The response message containing the greetings. | ||
message GenericOutputParam { | ||
string msgOut = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Threading.Channels; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Logging; | ||
|
||
using Grpc.Core; | ||
|
||
namespace GrpcService.Services | ||
{ | ||
public class FXService : FXGrpcService.FXGrpcServiceBase | ||
{ | ||
public override async Task<GenericOutputParam> GenericMethod(GenericInputParam request, ServerCallContext context) | ||
{ | ||
Console.WriteLine($"Received {request.MsgIn}"); | ||
|
||
return await Task.FromResult(new GenericOutputParam { MsgOut = "received " + request.MsgIn }); | ||
} | ||
|
||
public override async Task GenericStreamOutputMethod(GenericInputParam request, IServerStreamWriter<GenericOutputParam> responseStream, ServerCallContext context) | ||
{ | ||
Console.WriteLine(request.MsgIn); | ||
|
||
await responseStream.WriteAsync(new GenericOutputParam { MsgOut = "ack" }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"ConnectionStrings": { | ||
"MainDB": "Server=localhost;Port=5432;Database=runintomedb;User Id=postgres;Password='localDevPassword'" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*", | ||
"Kestrel": { | ||
"EndpointDefaults": { | ||
"Protocols": "Http2" | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.