---
title: "onViabilityUpdate(_:)"
framework: network
role: symbol
role_heading: Instance Method
path: "network/networkconnection/onviabilityupdate(_:)-70awf"
---

# onViabilityUpdate(_:)

Set a closure to be called when the connection’s viability changes, which may be called multiple times until the connection is cancelled.

## Declaration

```swift
@discardableResult final func onViabilityUpdate(_ handler: @escaping @isolated(any) @Sendable (NetworkConnection<ApplicationProtocol>, Bool) -> Void) -> Self
```

## Discussion

Discussion Connections that are not currently viable do not have a route, and packets will not be sent or received. There is a possibility that the connection will become viable again when network connectivity changes. This closure will inherit the isolation domain of the caller.
