YetAnotherHttpHandler, new HTTP/2, gRPC Client for Unity and .NET Framework
Cysharp has released a communication network client mainly for Unity, supporting HTTP/2, gRPC, and MagicOnion.
There are two gRPC implementations for .NET: Grpc.Core (C-Core), the native binding of gRPC that Google has been offering, and grpc-dotnet, the Pure C# implementation provided by Microsoft. Currently, .NET’s gRPC is entirely leaning towards the Pure C# implementation for both servers and clients, and MagicOnion is also using the Pure C# implementation on the server side.
However, regarding the client, we have long recommended C-Core since it does not run on Unity. Moreover, the Unity build was originally experimental, entered maintenance mode a while ago, and finally, in May of this year, it reached the end of support, casting an entirely unfavorable shadow. Additionally, issues arose, such as difficulties using it in Unity Editor due to the older x64 build, which does not run on recent Macs (M1, M2 chips).
As we provide MagicOnion, a communication library based on gRPC, we developed and released YetAnotherHttpHandler as a gRPC implementation that can be used without problems in Unity, given these concerns. It is implemented by replacing the HttpHandler, the communication layer of HttpClient, so it can be handled almost the same as regular .NET gRPC. Furthermore, it can be used as a gRPC Client that runs on the .NET Framework, which grpc-dotnet does not support.
The internal implementation is based on the Pure Rust implementation of the HTTP/2 library hyper and the Pure Rust TLS library rustls, using native libraries built on these foundations and communicating through C# bindings generated by Cysharp/csbindgen.
Furthermore, YetAnotherHttpHandler is not limited to gRPC or MagicOnion; it is a freely usable HTTP/2 Client in Unity, so it could be employed for uses such as accelerating asset downloads by utilizing HTTP/2. Please, feel free to try it out.