disconnect

abstract suspend fun disconnect()(source)

Disconnect gracefully.

Should transition state to TransportState.Disconnected. Idempotent: safe to call when already disconnected.

Cancellation: disconnect should run to completion even if the calling coroutine is cancelled — implementations are encouraged to use kotlinx.coroutines.NonCancellable internally for the resource-release path so the physical link is always closed. Cancellation may still be observed before any suspending I/O begins.