The list and its changes

The Space list `Spaces.list` reads, and hearing when it 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

SpaceList record#

The Spaces known now (Spaces.list_known) and how far the read got.

Returned by Spaces.list_known.

FieldTypeDefaultDescription
spacesVec<SpaceInfo>This machine's Spaces, and the account's other computers' as far as they answered (the last known ones meanwhile).
incompleteboolSome of the account's computers have not answered yet: the list may grow, and an empty one is not "no Spaces". Always false from a daemon that predates it (it answers once every computer did).
reachingu32How many computers are still being reached (0 when unknown).
staleboolThe other computers' rows are the last known ones, not yet confirmed by the relay.
noticeStringWhy the account's computers could not be read, when they could not.
creatingVec<SpaceCreatingElsewhere>Spaces your other computers are creating now, from what each published through the relay (empty from a daemon that predates it).

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.