Skip to content

Commit

Permalink
feat: supported ClientStreaming.
Browse files Browse the repository at this point in the history
  • Loading branch information
netcore-jroger committed Feb 2, 2021
1 parent b8b61e5 commit 262cee1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ Console.WriteLine($"Id: {userDto.Id}, Name: {userDto.Name}, CreateDate: {userDto
```

#### ServerStreaming
> not support
> not supported
#### DuplexStreaming
> not support
> not supported
## Roadmap

- [x] Unary support.
- [x] Unary supported.

- [x] ClientStreaming support.
- [x] ClientStreaming supported.

- [ ] ServerStreaming support.
- [ ] ServerStreaming supported.

- [ ] DuplexStreaming support.
- [ ] DuplexStreaming supported.
3 changes: 3 additions & 0 deletions sample/ServerSample/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
Expand All @@ -17,6 +18,8 @@ public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json", false, true).Build();

//services.AddSingleton<IRpcServiceTypeFinder, FakeRpcServiceTypeFinder>();
Expand Down
5 changes: 4 additions & 1 deletion sample/ServerSample/UserService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Text.Json;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
Expand All @@ -10,6 +12,7 @@ namespace ServerSample
{
public class UserService : RpcServiceBase, IUserService
{
private static readonly JsonSerializerOptions _options = new JsonSerializerOptions { Encoder = JavaScriptEncoder.Create(UnicodeRanges.All) };
private readonly ILogger<UserService> _logger;

public UserService(ILoggerFactory loggerFactory)
Expand All @@ -19,7 +22,7 @@ public UserService(ILoggerFactory loggerFactory)

public Task<UserDto> GetUserBy(UserRequest request, CancellationToken token = default)
{
this._logger.LogInformation($"Receive client message:{JsonSerializer.Serialize(request)}");
this._logger.LogInformation($"Receive client message:{JsonSerializer.Serialize(request, _options)}");

return Task.FromResult(new UserDto
{
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<RepositoryUrl>https://github.com/netcore-jroger/SimpleRpc</RepositoryUrl>
<PackageProjectUrl>https://github.com/netcore-jroger/SimpleRpc</PackageProjectUrl>
<PackageTags>gRPC</PackageTags>
<Version>0.1.9</Version>
<Version>0.1.10</Version>
<Copyright>JRoger © 2019-2021</Copyright>
</PropertyGroup>
</Project>

0 comments on commit 262cee1

Please sign in to comment.