liveBook · Manning

Wait

As explained in API Design Patterns

Waiting is an asynchronous-operation retrieval strategy that keeps a request open until the operation reaches a terminal state.

Waiting retrieves a long-running operation by keeping a client request open until the service marks the operation complete. It favors immediate notification over repeated client requests, while leaving connection management to the API service. section 10.3.3

Compared with polling, waiting:

  • Avoids repeated status requests that may produce no update. section 10.3.3
  • Reports completion as soon as the service knows the result. section 10.3.3
  • Requires a long-lived client-to-service connection. section 10.3.3

Waiting for chat-room creation

Create a chat room, then call WaitOperation with the returned operation ID. When the operation completes, return its ChatRoom result instead of repeatedly calling GetOperation.

How API Design Patterns covers it

How deep it goes
Defines the blocking-request behavior and contrasts its resource trade-off with client polling.
Examples
Uses chat-room creation, operation identifiers, WaitOperation, and a returned ChatRoom result.
What it assumes
Assumes familiarity with long-running operations, operation IDs, completion state, and operation results.
What you can do after
Apply it via a custom WaitOperation method to receive a completed resource without client-side polling.
How it connects
Connects long-running operations, polling, GetOperation, and custom API methods.

Also explained in

Compare how 2 books explain wait →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.