List changes

Hear when the Space list changed, so it is read again then instead of on a timer.

Spaces.watch_list calls a SpacesListListener once at the start and again whenever the list changes: this computer's Spaces within a second, your other computers on the mesh within about a second of connecting or going away, the others within 10 seconds. Read the list again (Spaces.list) when it is called. It reopens by itself after a daemon restart; SpacesListWatch.stop ends it.

List changes#

Methods of Spaces.

Spaces.watch_list#

Tells listener when the Space list changed: once at the start, then on every change. This computer's Spaces within a second; your other computers on the mesh within about a second of connecting or going away; the others within 10 seconds. Reopens by itself if the daemon restarts (and then calls listener again). Stop it with SpacesListWatch.stop.

def watch_list(self, listener: SpacesListListener) -> SpacesListWatch
ParameterTypeDefault
listenerSpacesListListenerrequired

Returns SpacesListWatch

SpacesListListener#

Hears that the Space list changed (Spaces.watch_list). Called on an SDK worker thread; return quickly (read the list on your own queue).

You implement SpacesListListener and pass it to the SDK (a callback interface): subclass it in Python, implement the interface in TypeScript, the SpacesListListener protocol in Swift, the interface in Kotlin and the trait in Rust.

MethodDescription
on_changedThe list changed (and once at the start): read it again.

SpacesListListener.on_changed#

The list changed (and once at the start): read it again. generation only increases while one daemon runs.

def on_changed(self, generation: int) -> None
ParameterTypeDefault
generationu64required

SpacesListWatch#

A running Spaces.watch_list. Dropping it also stops it.

Returned by Spaces.watch_list.

AccessorReturnsDescription
stop()Ends the watch. No call is made after this returns.