APIs & Communication
Every system is a set of parts that talk to each other, and each way of talking decides who waits, who can start the conversation and what happens when the other side is slow or gone. A request that waits for an answer is simple and fails with the service it waits for. A server that cannot call a browser has to be asked, or must keep a channel open. A provider that calls your endpoint will call it again if you are slow. This module is about these choices.
You will work with a message flow that sends the same two updates to a client by four techniques and shows what each one costs in messages and in time, with a sorting exercise on waiting or handing over, three short checks and a quiz, and three C# examples: a deadline passed down a chain of services, a stream of events that resumes after a drop, and a webhook receiver.
The lessons
Section titled “The lessons”- REST and HTTP APIs: resources, methods and retries (16 min). What REST asks of an API, what a method promises, and what a client may repeat after a timeout.
- RPC and gRPC: calls with a contract and a deadline (18 min). What a remote call hides, how gRPC carries it over HTTP/2, and how a deadline travels down a chain.
- Polling and long polling: asking until there is news (18 min). Why a client has to ask, what the interval costs, and the floor that round trips set.
- Server-sent events and WebSockets: a channel that stays open (20 min). One-way streams and two-way connections, and how a client resumes after a drop.
- Webhooks: when the server calls you (20 min). Signatures, a fast answer, repeats and disorder.
- Synchronous or asynchronous: who waits for whom (18 min). What waiting costs in availability, and a sorting exercise on when to hand over.
- Recap and quiz (12 min). The module in one page, a checklist, and a quiz.
What you will be able to do
Section titled “What you will be able to do”- Say which HTTP methods a client may repeat after a timeout, and why a POST needs a key.
- Explain what a gRPC call is made of, and pass a deadline down a chain of services.
- Choose between short polling, long polling, server-sent events and a WebSocket for a use, and read their costs from the messages they need.
- Receive a webhook correctly: verify it, answer first, and survive repeats and disorder.
- Decide for each call whether to wait for the answer or hand the work over, and count what waiting costs in availability.
All the numbers in the lab are illustrative floors set by round trips, not measurements of any real product.
Built by GhaziAlibi.
© ShardCraft. All rights reserved.