Server.liveState
A live, continuously rebuilt view of server, as a StateFlow.
Source and package
- Qualified name
-
io.github .libtmux .kotlin .Server. live State - Package
- io.github.libtmux.kotlin
- Declared in
Server- Distribution
- io.github.libtmux:libtmux-kotlin
- Source
- libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/LiveState.kt
- public
Kotlin suspending functionsAllows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself. fun Server.liveState( session: Session, scope: CoroutineScope , attachTimeout : Duration = config.defaultTimeout ().toKotlin (), ): StateDuration Flow <ServerMirror >.View -
Description
Wraps Java's
ServerMirrorrather than reinventing it: every routine case — resnapshot on notification, on gap, and on reconnect; conflation while a rebuild is in flight; ending oncesessionitself is gone — is already handled once, correctly, insideServerMirror. This function's only job is pumpingServerMirror.awaitNeweron a dedicated thread fromExecutionPolicy.streamReadsand publishing what comes back. NamedliveState, notServerMirror, so it does not collide with the Java type it wraps.scopeowns the returnedStateFlow's whole lifetime: closing the mirror is this function's ownlaunch+finally, tied toscope's cancellation, so the caller never has to close it by hand.- Parameters
-
-
attachTimeout(Duration) – how long to wait for the first attach, and the deadline each later rebuild wait uses to recheckscopefor cancellationDefault
config.defaultTimeout().toKotlinDuration()
- Errors
-
-
io
.github – synchronously if.libtmux .exception .Target Gone Exception session's server has already gone when this is called; later, the same failure endsscopeinstead, since it surfaces from the launched pump rather than from this call
-
Recorded calls
source callsThe Kotlin reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls io.github.libtmux.kotlin.Server.liveState.
Guides
task materialPages that discuss liveState.