Skip to content

Commit

Permalink
Update interceptor docs (#200)
Browse files Browse the repository at this point in the history
Updating inline docs to reflect
connectrpc/connectrpc.com#68.
  • Loading branch information
rebello95 authored Oct 19, 2023
1 parent 614fe6a commit 2d072c6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Libraries/Connect/Interfaces/Interceptors/Interceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,23 @@
///
/// Every interceptor has the opportunity to perform asynchronous work before passing a potentially
/// altered value to the next interceptor in the chain. When the end of the chain is reached, the
/// final value is passed to the networking client where it is sent to the server (outbound request)
/// or to the caller (inbound response).
/// final value is passed to the networking client, where it is sent to the server
/// (outbound request) or to the caller (inbound response).
///
/// Interceptors may also fail outbound requests before they're sent, thus preventing subsequent
/// interceptors from being invoked and returning a specified error back to the original caller.
/// Interceptors may also fail outbound requests before they are sent; subsequent
/// interceptors in the chain will not be invoked, and the error will be returned to the
/// original caller.
///
/// Interceptors are closure-based and are passed both the current value and a closure which
/// Interceptors are closure-based and receive both the current value and a closure that
/// should be called to resume the interceptor chain. Propagation will not continue until
/// this closure is called. Additional values may still be passed to a given interceptor even
/// this closure is invoked. Additional values may still be passed to a given interceptor even
/// though it has not yet continued the chain with a previous value. For example:
///
/// - A request is sent
/// - Response headers are received, and an interceptor pauses the chain while processing them
/// - First chunk of streamed data is received, and the interceptor is invoked with this value
/// - Interceptor is expected to resume with headers first, and then with data after
/// 1. A request is sent
/// 2. Response headers are received, and an interceptor pauses the chain while processing them
/// 3. The first chunk of streamed response data is received, and the interceptor is invoked with
/// this value
/// 4. The interceptor is expected to resume with headers first, and then with data after
///
/// Implementations should be thread-safe (hence the `Sendable` requirement on interceptor
/// closures), as closures can be invoked from different threads during the span of a request or
Expand Down

0 comments on commit 2d072c6

Please sign in to comment.