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
@discardableResult final func onViabilityUpdate(_ handler: @escaping @isolated(any) @Sendable (NetworkConnection<ApplicationProtocol>, Bool) -> Void) -> SelfDiscussion
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.