Address Book & Directory
Address Book & Directory
Address Book & Directory
client.directory is the runtime view of every
Address the authenticated user can reach
— other Users, video rooms, AI agents, SWML scripts, anything
the platform has surfaced into this user’s scope. Each entry is an
Address instance that you can read identity from, dial, message,
and inspect for call history.
The directory is paginated, observable, and lazily loaded: subscribe
to addresses$ and pages stream in as you call loadMore().
client.directory$ emits once the client is connected; subscribe to
it instead of reading client.directory synchronously to avoid the
“not yet authenticated” race. The directory itself outlives any
single addresses$ subscription — it’s the manager that owns the
state.
The directory does not load on its own — addresses$ emits []
until you call loadMore(). Subscribe first, then trigger the first
page; every subsequent page works the same way.
Reading directory.addresses synchronously before loadMore() has
resolved gives you an empty array — it’s the snapshot of state the
SDK currently holds, not a promise that fetches. Always drive your
UI from addresses$.
The collection is reactive — when a server-side update lands (e.g. a
new contact added in the background), new entries appear in the
existing addresses$ stream without you re-fetching.
Address gives youIdentity (name, displayName, type, resourceId), visuals (preview /
cover URLs), communication channels (audio / video / messaging URIs),
room state, and the conversation handle (sendText, textMessages$,
history$). Like everything in the SDK, mutable state is exposed
twice — as a synchronous getter and as a $ observable. The full
shape is on the Address reference page; this guide covers the
fields you’ll actually drive UI off of.
Address.type tells you what kind of Resource is on the other end:
Use it to drive UI affordances — show a video icon for rooms, a phone icon for users, an avatar for AI agents:
address.channels reports which communication modes the resource
supports. A video room exposes { audio, video, messaging }; a phone
address might be { audio } only. The defaultChannel getter picks
the right one for a one-click dial (video for rooms, audio
otherwise).
When you know the URI (/public/support, /private/jane) and need
the Address instance — to inspect channels, send a message, or
hand to client.dial() — use findAddressIdByURI:
findAddressIdByURI checks the local cache first, then queries the
server. directory.get(id) is a pure local lookup — call it only
after the id is known to exist.
For the reactive equivalent, directory.get$(id) returns an
Observable<Address> that emits whenever the entry’s state changes.
client.dial() accepts either the URI directly or an Address
instance:
Passing the Address lets the SDK pick the right channel
automatically when one isn’t pinned in the URI.
Each address owns its own conversation: address.sendText(),
address.textMessages$, and address.history$. See
Messaging & Chat for
the patterns — same pagination shape as the directory, lazy-loaded
on first subscribe.
For room-type addresses, locked$ reports whether the room is
currently accepting new joins. Lock state changes mid-call propagate
through the same observable:
previewUrl$ and coverUrl$ carry the room’s thumbnail and banner
images when the platform has them.
This is the same shape <sw-directory> builds on top of in the web
components — see the
Web Components reference if
you’d rather drop in a pre-styled list.
SignalWire.directory$ / directory — the directory managerDirectory interface — addresses$, loadMore(), hasMore$, loading$, get(), get$(), findAddressIdByURI()Address — the per-entry class (name, displayName, type, channels, sendText, textMessages, locked, coverUrl$)SignalWire.dial() — accepts an Address or URI