Skip to main content...
Networking: Life of a Packet
25 min

Day 22: WebSockets vs SSE vs gRPC; NAT, CIDR, subnets

When request/response isn't enough

Plain HTTP is request-then-response — the server can't push data to the client unprompted. Three patterns fill that gap, each suited to a different shape of problem.

  • WebSockets — a full-duplex, persistent connection; either side can send at any time. Best for bidirectional, high-frequency traffic (chat, live collaboration, gaming).
  • SSE (Server-Sent Events) — a simple one-way stream from server to client over plain HTTP. Best when only the server needs to push (live notifications, progress updates) and you want something simpler than WebSockets.
  • gRPC — a strongly-typed RPC framework over HTTP/2, with streaming support in both directions. Best for service-to-service communication where you want a strict contract (via Protobuf) and top-tier performance.

Pick the least powerful tool that fits

SSE is simpler to operate (it's just HTTP — works through most proxies/load balancers with zero special handling) and is the right choice whenever the client never needs to push data back. Reach for WebSockets only when you genuinely need bidirectional, low-latency traffic.

NAT, CIDR, and subnets

NAT (Network Address Translation) lets many devices on a private network share one public IP address — your home router rewrites outgoing packets' source address to its own public IP, and remembers how to route replies back to the right internal device.

CIDR notation (10.0.0.0/16) describes an IP range: the number after the slash is how many leading bits are fixed as the network prefix, leaving the rest for host addresses. A /24 gives you 256 addresses; a /16 gives you 65,536. Subnetting is dividing a larger network into smaller ones — exactly what you'll do deliberately when designing a VPC in Phase 20.

Key terms

WebSocket
A persistent, full-duplex connection allowing either side to send data at any time.
SSE
A one-way, server-to-client streaming pattern built on plain HTTP.
NAT
Rewriting private IP addresses to a shared public IP so multiple devices can share one address for outbound traffic.
CIDR
Notation (e.g. /24) describing an IP range by how many bits are fixed as the network prefix.

You need to push live progress updates to a browser, one-directionally, with minimal operational complexity. What's the best fit?

We use cookies

We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies. Learn more

    Day 22: WebSockets vs SSE vs gRPC; NAT, CIDR, subnets | RBTechIconX