cancelCallOnClose

When true, cancels the call coroutine context if the other peer resets the client connection. When false (default), request processing continues even if the connection is closed.

**When to use this property: **

  • Set to true for long-running or resource-intensive requests where you want to stop processing immediately when the client disconnects (e.g., streaming, batch processing, heavy computations)

  • Keep as false (default) for short requests, or when you need to complete processing regardless of client connection status (e.g., important side effects, database transactions)

Example:

install(HttpRequestLifecycle) {
cancelCallOnClose = true
}

Report a problem