flush
Wait, up to timeout, until a leave cannot throw away what this room accepted before this call: the frames it was waiting to forward or announce, then the fabric's own.
Send a last frame, flush, then leave: without the flush the last frame can be lost to the leave, and a delay only guesses at how long that takes.
Most rooms answer us.tractat.kuilt.core.FlushOutcome.Unsupported today, having drained their own queues, because the fabric under them cannot tell: a room on RoomHubSeam, MeshSeam or NwSeam among them. Deleting a working delay there just loses the frame sooner, so keep it or an acknowledgement until your fabric answers. What confirms a drain, a list that only grows: LinkSeam over a WebSocket except an OkHttp client, LinkSeam over framed() (so TCP), and InMemoryLoom.
Parameters
how long to wait in all. kotlin.time.Duration.INFINITE waits as long as it takes; zero or less does not wait.
Samples
room.sendTo(member, lastFrame)
val outcome = room.flush(2.seconds)
// Most rooms answer Unsupported today, at once. Keep your delay or an ack until your fabric answers.
if (outcome == FlushOutcome.Unsupported) delay(delayYouHadBefore)
room.leave()
return when (outcome) {
FlushOutcome.Drained -> true
// Not proven, not lost. This fabric cannot tell, a link stalled, or the room already ended.
FlushOutcome.Unsupported, FlushOutcome.TimedOut, is FlushOutcome.Failed -> false
}