Communication layer protocols: HTTP, gRPC, WebSocket and RSocket, and when to switch

HTTP/1.1, HTTP/2, HTTP/3, WebSocket, gRPC and RSocket are all interaction protocols. They decide how two systems talk, while TCP and QUIC only move the bytes. Learn what each one adds, why REST and Protobuf are not on the list, and the simple rule for when to move off REST.

Six cards in a row, each a different shape of conversation. HTTP/1.1 shows one request then its answer. HTTP/2 shows many numbered streams sharing one TCP connection. WebSocket shows arrows going both ways at once. gRPC shows a small contract file with typed methods. RSocket shows a funnel with an arrow going back up labelled request(3). HTTP/3 shows the same numbered streams on a QUIC connection. Dashed lines drop from each card to a road at the bottom labelled transport, moves bytes; the first five stand on TCP and HTTP/3 stands on QUIC.
Fig. 1 — Interaction protocols decide the shape of the conversation. Transport protocols are the road underneath.

Sit in enough design meetings and you will hear a sentence like this:

“Should we use REST, gRPC, Protobuf or non-blocking for the new service?”

It sounds like a choice between four options. It isn’t. Those four words belong to four different categories: one is an architecture style, one is a protocol, one is a data format and one is a way of running code. Mixing them up leads to bad decisions, like rewriting a working API “for performance” when the real problem was somewhere else.

This article sorts it out. We’ll look at the six interaction protocols you’ll meet in real systems, what each one adds, and the one rule that decides when to move from one to another:

“We choose a protocol when we hit its limits, not before.”

If you haven’t read them yet, REST vs gRPC vs GraphQL vs WebSockets covers what each API looks like in code, and multiplexing, full duplex and QUIC explains the networking words. This piece sits on top of both: it’s about which layer each thing lives in, and when to switch.

Two kinds of protocol: moving bytes vs talking

Think about a phone call.

  • The phone network carries your voice from one phone to another. It doesn’t care what you say. It just makes sure the sound arrives.
  • How you talk is a different set of rules: you say hello, one person asks, the other answers, you say bye. Or you both talk at once and argue. Or one person reads out a long list while the other says “slow down”.

Software works the same way. There are two layers of protocol:

  • Transport protocols move bytes. TCP gives you a reliable, in-order stream of bytes. QUIC (built on UDP) gives you several reliable streams with encryption built in. Neither knows what a “request” or a “user” is.
  • Interaction protocols define how systems talk. Who speaks first? Is it one question and one answer, or a stream? Can both sides speak at once? What does an error look like? Can the listener say “slow down”?
Left, a stack of layers. Top, interaction protocols, labelled how systems talk: HTTP/1.1, HTTP/2, HTTP/3, WebSocket, gRPC and RSocket, with the note who speaks, in what pattern, what a message means. Below, transport protocols: TCP, a reliable byte stream that resends losses, and QUIC over UDP, reliable streams with TLS built in. At the bottom, IP, which moves packets between machines. Right, three cards under the heading 'Often called protocols. They are not.': REST, an architecture style, resources at URLs plus HTTP verbs; Non-blocking, an execution model, how your code waits for I/O; Protobuf, a serialization format, how a message turns into bytes.
Interaction protocols ride on transport protocols. REST, non-blocking and Protobuf live somewhere else entirely.

All six names in this article (HTTP/1.1, HTTP/2, HTTP/3, WebSocket, gRPC, RSocket) are interaction protocols. They all run at the application layer, on top of a transport.

Technology Layer Responsibility
HTTP/1.1 Interaction Request–response rules
HTTP/2 Interaction Multiplexed requests
HTTP/3 Interaction Same HTTP rules over QUIC transport
WebSocket Interaction Full-duplex messaging
gRPC Interaction Typed RPC + streaming
RSocket Interaction Reactive messaging + backpressure

Three things that are not protocols

Here’s where most of the confusion comes from.

REST is an architecture style, not a protocol. REST is a set of design ideas: treat things as resources with URLs, use HTTP verbs like GET and POST, keep each request stateless. There is no “REST protocol” on the wire. A REST API uses HTTP. You can run the same REST API over HTTP/1.1, HTTP/2 or HTTP/3 without changing a line of your controller.

Non-blocking is an execution model, not a protocol. It describes how your code waits: does a thread sit idle while the network works, or is it freed up to do other things? You can call a plain HTTP/1.1 API with a non-blocking client, and you can call gRPC with a blocking one. (We covered this in synchronous vs asynchronous communication.)

Protobuf is a serialization format, not a protocol. Protocol Buffers decide how a message like User { id, name } turns into bytes. JSON is another format. A format says nothing about who talks when, or how errors work.

So what is gRPC, exactly? It’s easiest to see it unpacked.

gRPC unpacked into layers. Top, gRPC, the RPC rules, what a call means: service.method, deadline, cancellation, status codes like NOT_FOUND, unary plus three kinds of stream, and metadata headers. Middle, HTTP/2: framing, multiplexing and flow control, shown as a row of HEADERS and DATA frames. Bottom, TCP, a reliable in-order stream of bytes. To the right, a Protobuf card turns a User message with id 1 and name Asha into the bytes 0a 01 31 12 04 41 73 68 61, and an arrow shows those bytes going inside the HTTP/2 DATA frames.
gRPC defines the RPC rules. HTTP/2 carries them, TCP moves the bytes, and Protobuf is the format of each message.

Once you see the layers, the meeting question falls apart. “REST or gRPC” is a fair question: both describe how services talk. “gRPC or Protobuf” isn’t: gRPC uses Protobuf. “REST or non-blocking” isn’t either: you can have both at once.

The six interaction protocols, one by one

HTTP/1.1: one question, one answer

The client sends a request, waits, and gets a response. On one connection, the next request waits until the previous answer is done. Browsers work around this by opening several connections to the same site (usually about six).

  • Good at: being simple, readable and supported by every tool, proxy, cache and language on earth.
  • Limit: many small requests queue up behind each other. A page that needs 80 files feels slow.

HTTP/2: many requests on one connection

Same HTTP rules (methods, URLs, headers, status codes), but the bytes are cut into small binary frames, each tagged with a stream number. Many requests and responses share one connection at the same time. That’s multiplexing.

  • Good at: pages and services that make lots of small calls; it also compresses repeated headers.
  • Limit: it still runs on TCP. If one TCP packet is lost, every stream on that connection waits for it to be resent (head-of-line blocking at the transport level).

HTTP/3: the same HTTP, on a new road

Same HTTP rules again, but over QUIC instead of TCP. QUIC knows about streams, so a lost packet only pauses the one stream it belonged to. It also sets up connections faster and can survive a phone switching from Wi-Fi to mobile data.

  • Good at: mobile users and lossy networks.
  • Limit: some corporate networks block or slow down UDP, so clients must fall back to HTTP/2.

Notice the pattern: HTTP/1.1, HTTP/2 and HTTP/3 are the same conversation rules on better and better plumbing. Your REST API doesn’t change. That’s why moving between them is usually a setting on your load balancer or CDN, not a rewrite.

WebSocket: a line that stays open

A WebSocket starts life as an ordinary HTTP request that asks to “upgrade”. After that, the connection stays open and both sides can send messages at any time. That’s full duplex.

  • Good at: pushing updates the instant they happen: chat, live scores, notifications, dashboards.
  • Limit: it gives you a pipe, not a conversation design. There are no built-in request IDs, error codes, methods or “slow down” signals. You invent your own message types on top. Every open connection also lives on one server, which makes scaling and deploys harder.

gRPC: typed calls between services

You write the contract once in a .proto file, and tools generate client and server code in many languages. Calling another service looks like calling a method. On top of plain calls, gRPC gives you four call shapes (unary, server streaming, client streaming and bidirectional streaming), plus deadlines, cancellation and standard status codes.

  • Good at: lots of internal services calling each other, where a broken contract or a slow call is expensive.
  • Limit: browsers can’t call it directly (you need gRPC-Web or a gateway), binary messages are harder to read, and the team needs .proto files and code generation.

RSocket: streams where the receiver sets the pace

RSocket is a binary protocol built around Reactive Streams. Once a connection is open, either side can start a request, using one of four interaction models:

  • Request-response: one message, one reply.
  • Fire-and-forget: one message, no reply.
  • Request-stream: one message, a stream of replies.
  • Channel: streams in both directions.

Its headline feature is backpressure built into the protocol: the receiver says “send me N more” with a REQUEST_N frame, and the sender must not send more than that. It runs over TCP, WebSocket and other byte-stream transports, and it’s best supported in the Java world through Spring.

  • Good at: heavy streaming where the producer can outrun the consumer.
  • Limit: a much smaller ecosystem than HTTP or gRPC: fewer tools, fewer people who know it, fewer gateways that understand it.

We go frame by frame through all four models in RSocket explained.

The rule: move only when it hurts

Every protocol on that list solves a real problem. Every one also costs something: new tools, new failure modes, new things for the team to learn. So the order of thinking is:

  1. Start with REST over HTTP.
  2. Watch for a specific pain.
  3. Move only the part of the system that hurts, to the protocol built for that pain.
A decision map titled 'Move only when it hurts'. In the middle, a dark box: REST over HTTP, start here, stay while it works. Four arrows point out to four cards. gRPC: move when one service calls many others, contract changes break callers, deadlines and cancellation matter. WebSocket: move when a live screen must update now; notifications, chat, dashboards; not for 'faster' request and reply. RSocket: move when the producer is faster than the consumer, memory fills with buffered items, and the system is reactive from end to end. HTTP/2 and HTTP/3: move when pages make many small requests or users are on slow, lossy networks; often a setting, not a rewrite. At the bottom: few services, low fan-out, small team, UI-facing API, so REST is enough.
Each arrow is a specific pain. No pain, no move.

If REST is not hurting, do not replace it.

When REST is enough

REST over HTTP is the right answer far more often than conference talks suggest. It’s enough when you have:

  • Few services. A handful of services calling each other a few times per request.
  • Low fan-out. One incoming request turns into one or two internal calls, not twenty.
  • Small teams. Everyone can read JSON in a browser and test with curl. No code generation, no special tools.
  • UI-facing APIs. Browsers, mobile apps and partners all speak HTTP and JSON out of the box.

REST also gets HTTP caching, CDNs, API gateways, logging and debugging tools for free. That’s a lot to give up.

Do not move unless these limits hurt.

When to move to gRPC

gRPC earns its cost when your system turns into a busy web of internal calls:

  • Orchestrators. A checkout service that calls pricing, inventory, tax, payment and shipping for every order.
  • High fan-out services. One user request becomes 10 to 50 internal calls. Small savings per call add up fast.
  • Many internal services. Dozens of teams, each calling the others, often in different languages.
  • Contract breakages hurt. Someone renamed a JSON field and three teams found out in production. With a .proto contract, the mismatch shows up when code is compiled.
  • Cancellation and time budgets matter. The user’s request has 500 ms in total. If tax is slow, you want the whole chain to give up together, not keep working on an answer nobody will read.

That last point is the one people underrate. In gRPC, a deadline is part of the call:

// Java · CheckoutOrchestrator.java (grpc-java)
try {
    Price price = pricingStub
            .withDeadlineAfter(300, TimeUnit.MILLISECONDS)   // this call gets 300 ms, total
            .getPrice(PriceRequest.newBuilder().setSku(sku).build());
} catch (StatusRuntimeException e) {
    if (e.getStatus().getCode() == Status.Code.DEADLINE_EXCEEDED) {
        // fall back: cached price, or a clear error to the caller
    }
}

In grpc-java, if the pricing service calls another service while handling this request, the remaining time travels with it. When the caller gives up or the deadline passes, the work is cancelled down the chain. With plain REST you have to build all of that yourself.

gRPC solves orchestration pain, not business complexity. If your services are hard to understand because the business rules are tangled, a faster protocol won’t untangle them.

When to use WebSockets

WebSockets are for when the server has news and the user is watching:

  • Live UI: a delivery tracker, a shared document, a game.
  • Notifications: “your payment went through” without refreshing.
  • Chat: messages both ways, any time.
  • Dashboards: prices, metrics or order counts changing every second.

Do NOT use WebSockets just for “performance”. For ordinary request-and-reply calls, a WebSocket doesn’t make anything meaningfully faster: HTTP/2 already reuses one connection. What you do get is extra work: your own message format, your own error handling, sticky connections, reconnect logic, and a way to reach users connected to other servers.

If only the server sends (notifications, a progress bar, an AI answer streaming in), Server-Sent Events over plain HTTP are often simpler still.

When to use RSocket

RSocket is the most specialised protocol on the list. Reach for it when:

  • The system is streaming-heavy. Long streams of events, not one-off calls.
  • The producer is faster than the consumer. A price feed sends 1,000 updates a second; a mobile client can draw 100.
  • Backpressure is critical. Without it, something in the middle buffers the extra items until memory runs out, or quietly drops them.
  • The system is reactive end to end. Your services already use Reactor or another Reactive Streams library, so demand can flow all the way back to the source.
Two rows. Top row, without backpressure: a producer sending 1,000 items a second pushes a long line of red dots into a bucket that overflows, spilling dots, while only a few dots trickle out to a consumer that handles 100 items a second. Note: buffer grows, out of memory, or items dropped. Bottom row, with backpressure (RSocket): a dashed arrow goes from the consumer back to the producer carrying the message REQUEST_N(10), send me 10 more. The producer, which sends when asked, sends only a few evenly spaced dots. Note: the consumer sets the pace, nothing piles up in between.
Backpressure lets the slow side set the pace. In RSocket it's part of the protocol, not something you bolt on.

With Spring, a streaming endpoint and a client that asks for items in batches look like this:

// Java · PriceController.java (Spring, RSocket)
@Controller
class PriceController {
    @MessageMapping("prices")
    Flux<Price> prices(String symbol) {
        return priceFeed.stream(symbol);         // may produce very fast
    }
}

// Java · the client
requester.route("prices").data("INFY")
        .retrieveFlux(Price.class)
        .limitRate(10)                          // ask for 10 at a time; sent upstream as REQUEST_N
        .subscribe(this::draw);

“But gRPC streams have flow control too.” True: HTTP/2 has flow-control windows, measured in bytes, so a gRPC stream won’t flood a slow reader forever. The difference is that RSocket’s demand is counted in messages and maps straight onto Reactive Streams, so “I can handle 10 more” travels across the network exactly as your code says it. For most streaming, gRPC’s flow control is enough.

Only use RSocket if backpressure pain is real. You’re trading a big ecosystem for one strong feature. Make sure you need it.

What about HTTP/2 and HTTP/3?

These are the easiest moves of all, because the conversation rules don’t change:

  • Turn on HTTP/2 when browsers or services make many small requests to the same place. Most load balancers, CDNs and modern Java servers support it with a setting.
  • Turn on HTTP/3 at your CDN or edge when many users are on mobile or flaky networks. Keep HTTP/2 as the fallback.

Your REST controllers, your JSON and your status codes stay exactly as they were.

Puzzle 1: “WebSockets will make our API faster”

Almost certainly not. First, find where the 900 ms goes. It’s usually a slow database query, a chain of calls made one after another, or a service waiting on a lock, not the protocol. A WebSocket saves a little connection set-up, which HTTP keep-alive and HTTP/2 already avoid.

If the slowness comes from fan-out (the order service calls eight others in a row), the fixes are to call them in parallel, add deadlines, and maybe move those internal calls to gRPC. WebSockets are for pushing live updates to users, not for speeding up request-and-reply.

Puzzle 2: the stream that ate the memory

Ask where the items pile up. If the analytics service reads a stream into an unbounded in-memory queue, no protocol can save it: the code is accepting work faster than it finishes it. First, bound that queue and process items as they arrive.

Then look at what you already have. If the stream is gRPC, HTTP/2 flow control will slow the sender once the receiver stops reading, as long as the receiver doesn’t read everything into memory first. If the data can wait, a message queue like Kafka lets the consumer read at its own pace. RSocket is the right move when the whole path is reactive and you want demand counted in messages, end to end. Backpressure pain is real here, but make sure the protocol is the bottleneck before you change it.

Common misconceptions

  • “REST is a protocol.” It’s an architecture style. HTTP is the protocol it uses.
  • “gRPC is faster because of Protobuf.” Protobuf helps (smaller, faster to parse), but so do HTTP/2 multiplexing and long-lived connections. And the bigger wins in most systems are deadlines, cancellation and strict contracts.
  • “Non-blocking means using a different protocol.” It’s about how your threads wait. Any protocol can be called in a blocking or non-blocking way.
  • “WebSockets are a faster HTTP.” They’re a different shape of conversation: an open, two-way line. For request-and-reply they add work, not speed.
  • “HTTP/3 means rewriting our APIs.” HTTP/3 keeps the same HTTP rules. It’s usually a setting at the edge.
  • “We’ll need gRPC eventually, so start with it.” Maybe. But you pay the cost today for a pain you may never have. Move when it hurts.

Quick reference

Protocol Runs over Shape of conversation Choose it when Watch out for
HTTP/1.1 TCP One request, then one response Simple APIs, maximum compatibility Requests queue on each connection
HTTP/2 TCP Many requests share one connection Many small calls to the same host TCP packet loss stalls every stream
HTTP/3 QUIC (UDP) Same as HTTP/2 Mobile and lossy networks UDP blocked on some networks; keep a fallback
WebSocket TCP (starts as HTTP) Open line, both sides send any time Live UI, chat, notifications, dashboards No built-in errors, IDs or backpressure; sticky connections
gRPC HTTP/2 over TCP Typed calls + 4 kinds of stream Orchestrators, high fan-out, many internal services Not browser-native; needs .proto and tooling
RSocket TCP, WebSocket, others 4 models, either side can start, backpressure Producer faster than consumer, reactive end to end Small ecosystem; few tools and gateways

Key takeaways

  1. Transport protocols move bytes. Interaction protocols define how systems talk. TCP and QUIC are transports; HTTP/1.1, HTTP/2, HTTP/3, WebSocket, gRPC and RSocket are interaction protocols.
  2. REST is a style, non-blocking is an execution model, Protobuf is a format. None of them is a protocol, so don’t compare them with one.
  3. gRPC = RPC rules + HTTP/2 framing + TCP + Protobuf messages.
  4. REST over HTTP is the default. Few services, low fan-out, small teams and UI-facing APIs don’t need anything else.
  5. Move to gRPC for orchestration pain, WebSockets for live updates, RSocket for real backpressure pain, and HTTP/2 or HTTP/3 for many small requests or poor networks.
  6. We choose a protocol when we hit its limits, not before.

Frequently asked questions

Is gRPC a protocol or a framework?

Both words get used. gRPC defines a protocol (the rules for how calls, streams, deadlines and errors travel over HTTP/2), and the gRPC project also ships libraries and code generators for many languages that implement it.

Is REST a protocol?

No. REST is an architecture style: a set of design ideas such as resources at URLs, standard HTTP methods and stateless requests. A REST API uses HTTP as its protocol, and the same REST API can run over HTTP/1.1, HTTP/2 or HTTP/3.

What is the difference between a transport protocol and an application protocol?

A transport protocol such as TCP or QUIC moves bytes reliably between two machines and doesn’t know what they mean. An application (interaction) protocol such as HTTP, gRPC, WebSocket or RSocket defines the conversation on top: who sends what, in what order, and what a request, response or error looks like.

Should I use gRPC or REST for microservices?

Start with REST if you have a few services, low fan-out and a small team. Move the busy internal paths to gRPC when one service calls many others, contract changes keep breaking callers, or deadlines and cancellation across a chain of calls start to matter. Many systems use REST at the edge and gRPC inside.

When should I use WebSockets instead of HTTP?

Use WebSockets when the server must push updates the moment they happen and the client may send messages too, such as chat, live dashboards, notifications or collaborative editing. Don’t use them only to make ordinary request-and-reply calls faster; HTTP/2 already reuses connections.

What is backpressure, and why does RSocket have it?

Backpressure is a way for a slow receiver to tell a fast sender to slow down, so items don’t pile up in memory or get dropped. RSocket builds it into the protocol: the receiver sends REQUEST_N frames saying how many more messages it can take, and the sender must not send more than that.

Is RSocket better than gRPC?

Not in general. gRPC has a much larger ecosystem, better tooling and wide language support, and its streams already have HTTP/2 flow control. RSocket is a better fit only when heavy streaming with message-level backpressure is a real problem and your system is reactive end to end.

Want to go deeper on the pieces? The API styles in code are in REST vs gRPC vs GraphQL vs WebSockets, the plumbing under HTTP/2 and HTTP/3 is in multiplexing, full duplex and QUIC, and protecting a chain of calls when one of them fails is in resilience patterns.

Comments

LEAVE A COMMENT
No sign-up. Comments appear after a quick review.