closeExceptionally

suspend fun WebSocketSession.closeExceptionally(
    cause: Throwable
): Unit

Closes session with normal or error close reason, depending on whether cause is cancellation or not.