MagicOnion v4 — .NET 5 and ASP .NET Core gRPC with Code-First Contracts

https://devblogs.microsoft.com/aspnet/grpc-performance-improvements-in-net-5/
  • RPC services such as gRPC, used by Microservices, and WCF, commonly used by WinForms/WPF
  • API services such as ASP.NET Core MVC targeting Unity, Xamarin, and Windows clients
  • Bi-directional real-time communication such as Socket.io, SignalR, Photon and UNet

Code-First gRPC

Among the various components of gRPC, the most important one is probably the language-neutral schema and code generation by .proto.

Bidirectional Streaming RPC vs MagicOnion StreamingHub

Although gRPC can use Bidirectional streaming RPC, it cannot implement things like getting a return value or waiting for a process to server method complete because there is only a single fire-and-foget API. Furthermore, since only one endpoint type can be used, there is no choice but to use a large amount of oneof to isolate the call.

Unity and gRPC

In MagicOnion v4, the server side is now a Pure C# implementation based entirely on ASP.NET Core Kestrel. .NET Core client side is now a Pure C# implementation based on HttpClient. However,Unity client is continue to use C Core based one. This is because .NET Core based HTTP/2 support is not yet available in Unity. In other words, MagicOnion also officially supports the use of gRPC in Unity.

gRPC’s benefit

One of the reasons why we recommend gRPC is because of the abundance of middleware on the infrastructure side by using HTTP/2. By taking advantage of these, the flexibility of building a server has increased dramatically compared to proprietary network formats.

Roadmap

Creating a Unity client in v5, providing a load testing tool as a utility, and so on. The load testing tool in particular is coming soon.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Yoshifumi Kawai

Yoshifumi Kawai

a.k.a. neuecc. Creator of UniRx, UniTask, MessagePack for C#, MagicOnion etc. Microsoft MVP for C#. CEO/CTO of Cysharp Inc. Live and work in Tokyo, Japan.