close

abstract fun close(cause: Throwable?): Boolean

Closes this channel with an optional exceptional cause. All pending bytes are flushed. This is an idempotent operation — subsequent invocations of this function have no effect and return false

Return

true if the channel was cancelled/closed by this invocation, false if the channel was already closed

Parameters

cause

the reason the channel is closed, a non-null cause will result in a "failed" channel whereas a null cause will result in a closed channel (no more data will be written).