Core LibraryAPI Reference

Choose documentation 1

latest

Current version

latest
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

method libtmux-kotlin latest

Server.liveState

Package io.github.libtmux.kotlin.Server.liveState io.github.libtmux.kotlin

A live, continuously rebuilt view of server , as a StateFlow .

View as Markdown

Source and package
Module
io.github.libtmux.kotlin
Declared in
Server
Package
io.github.libtmux:libtmux-kotlin
Source
libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/LiveState.kt
public Kotlin suspending functions Allows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself. Language documentation fun Server.liveState( session: Session, scope: CoroutineScope, attachTimeout: Duration = config.defaultTimeout().toKotlinDuration(), ): StateFlow<ServerMirror.View>
methodasync [source]

Description#

Wraps Java's ServerMirror rather than reinventing it: every routine case — resnapshot on notification, on gap, and on reconnect; conflation while a rebuild is in flight; ending once session itself is gone — is already handled once, correctly, inside ServerMirror . This function's only job is pumping ServerMirror.awaitNewer on a dedicated thread from ExecutionPolicy.streamReads and publishing what comes back. Named liveState , not ServerMirror , so it does not collide with the Java type it wraps.

scope owns the returned StateFlow 's whole lifetime: closing the mirror is this function's own launch + finally , tied to scope 's cancellation, so the caller never has to close it by hand.

Parameters
  • session ( Session )

  • scope ( CoroutineScope )

  • attachTimeout ( Duration ) – how long to wait for the first attach, and the deadline each later rebuild wait uses to recheck scope for cancellation

Raises

Discussed in Coroutines and flows , Getting started

Esc

Type to search.