📎 Webclip
C# to C# Communication: REST, gRPC and everything in between
The article surveys common ways for a C# client to communicate with a C# server. It starts from an ideal of stateless, strongly typed, IntelliSense-friendly calls, then compares REST, ReFit, Swagger, and gRPC against that goal.
Reading notes#
- REST is the most common approach and uses GET, POST, PUT, and DELETE with JSON payloads.
- ReFit builds on REST and lets client calls look like method calls through a shared interface.
- Swagger defines a REST contract in JSON and can generate C# clients from that schema.
- Swagger tools mentioned include Swashbuckle.AspNetCore on the server and AutoRest or swagger-codegen on the client.
- The author says Swagger JSON is created at runtime, which makes CI/CD automation harder.
- gRPC uses .proto files as the contract and generates clients from them.
- gRPC uses Protobuf binary serialization, HTTP/2, multiplexed streams, and bidirectional streaming.
- The article says gRPC is usually faster than REST, especially for large payloads, but ASP.NET support still feels less mature.
- The author says moving a large ASP.NET app from REST to gRPC is hard, while a microservices setup makes gradual adoption easier.
- Other communication options mentioned are GraphQL, SignalR, TcpClient, UdpClient, and WCF.
