How to Utilize gRPC-Web From a Blazor WebAssembly Application
Premier Developer Consultant Wael Kdouh demonstrates how to use gRPC-Web from a Blazor WebAssembly Application.
It’s no secret by now that there has been a lot of excitement about gRPC recently in the .NET community. gRPC is a modern high-performance RPC (Remote Procedure Call) framework. It is based on HTTP/2, Protocol Buffers and other modern standard-based technologies. It is also an open standard and is supported by many programming languages, including .NET.
It is currently impossible to implement the gRPC HTTP/2 spec in the browser because there are no browser APIs with enough fine-grained control over requests. Well the good news is that gRPC-Web is here for the rescue!!!
gRPC-Web is a standardized protocol that solves this problem and makes gRPC usable in the browser. gRPC-Web brings many of gRPC’s great features, like small binary messages and contract-first APIs, to modern browser apps. In this post I will demonstrate consuming a gRPC-Web endpoint from within a Blazor WebAssembly application. Along the way I will also demonstrate how gRPC-Web can achieve more efficient payload sizes compared to Restful endpoints.