The default model for client-server communication is request-response. The client sends a request, the server returns a response, and the connection closes. This handles the majority of what most software needs to do, and it covers an enormous range of practical scenarios in modern web applications.
It doesn’t handle everything. Some work takes too long to complete inside a single request. Some events happen on the server’s schedule, not the client’s. Some interactions are continuous rather than one-shot. And some messages need to outlive the moment they were sent.
Async API patterns are the techniques engineers use for these cases, and the list has grown over the years. It now includes short polling, long polling, server-sent events, WebSockets, webhooks, async APIs with status polling, message queues, and GraphQL subscriptions. Each has its own design and preferred use case. What they share is one purpose, which is to extend what’s possible beyond a single HTTP request and response.
In this article, we will look at each of these patterns in detail, along with their advantages. We’ll start by looking at where request-response stops fitting and then walk through each pattern in turn.
[ad_2]
Source link
More on guide to async patterns in api
Stay tuned for updates on guide to async patterns in api as the story develops. Related: Is That Call, Text or Email Real? Here’s How to Identify Scams.
Frequently Asked Questions
Async API patterns are techniques engineers use when request-response does not fit: work that takes too long for one request, events on the server's schedule, continuous interactions, or messages that must outlive the moment they are sent.
The article covers short polling, long polling, server-sent events, WebSockets, webhooks, async APIs with status polling, message queues, and GraphQL subscriptions.
Request-response stops fitting when some work takes too long to complete inside a single request, some events happen on the server's schedule rather than the client's, some interactions are continuous rather than one-shot, and some messages need to outlive the moment they are sent.
What they share is one purpose: extending what is possible beyond a single HTTP request and response.


