Urgent.News

What's breaking now, across thousands of outlets.

Tech

gRPC Explained: APIs That Speak in Binary

A shop dashboard needs one thing from the orders service: the details of order 1042. Over plain JSON the request is easy to write and easy to break. A field is renamed from customer_name to customerName, the dashboard still reads the old name, and the page shows a blank. Nothing errors, and it surfaces only when a customer asks where their parcel is. Server and client each hold a private idea of…

gRPC is a protocol for building APIs that communicate in binary format, offering faster parsing and more efficient data transfer compared to JSON. It begins with a contract defined in a .proto file, which specifies the service, methods, and message structure using Protocol Buffers. This contract is then used to generate client and server code in the desired programming language, ensuring both sides have a shared understanding of the data's shape.

Communication occurs over HTTP/2, allowing multiple calls to share a single connection and enabling streaming of data in both directions. gRPC's main advantages are its tight integration between server and client, smaller and faster binary messages, and support for streaming. However, it is not suitable for public or browser-facing APIs, as it requires both the server and client to be owned by the same team and the calls to be frequent.

It also demands additional setup for debugging and requires HTTP/2 understanding from load balancers and proxies.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

WebSockets Explained: Real-Time Data Without Polling

A customer adds a ceramic mug to their basket on a small shop's website, then waits. The order page says Processing, and nothing changes until they refresh.

  • WebSockets enable real-time, two-way communication between web page and server.
  • Persistent connection allows server to push data to client without polling.

More from Saturday 7 November →