Cianplan

Level 1: Foundations · L1.1 APIs: REST, gRPC, GraphQL, WebSockets/SSE, webhooks

Real-time: polling, SSE, WebSockets, webhooks

Choose a push or pull mechanism for a real-time feature.

13 min · Free

What you take away

  • Polling is pull on a timer: simple, cacheable, stateless, and wasteful in proportion to how fresh you want to be.
  • Server-sent events push one way over plain HTTP and reconnect themselves — enough for most 'live' features.
  • WebSockets are the only option when the client must send continuously too, and the price is a stateful connection per user.
  • Webhooks are server-to-server push with at-least-once delivery: verify signatures, expect duplicates, ignore order.

How the class is laid out

  1. The problem
  2. The simple version
  3. REST
  4. Contracts
  5. Idempotency
  6. gRPC
  7. GraphQL
  8. Real-time
  9. Check your understanding