Only the members listed here are supported; other members are internal and can change between releases.
interface RtcTopologyConnector {
readonly members$: Observable<string[]>; // peer IDs of the other participants in this room
readonly neighbors$: Observable<string[]>; // peers with a direct connection to you
}Messages from your own connectors reach every member, directly or through other participants, so use members$ for "who is here". neighbors$ is useful only for connection diagnostics. For the peers your connector can message right now, use gateway.reachablePeers$ in the connector.
Example: a participant list
function participantList(app, root, destroy$) {
const { rxjs, connectors } = weei.sdk;
rxjs.combineLatest([
app.rtcService.getOrCreateConnector(connectors.RtcTopologyConnector),
app.rtcService.getOrCreateConnector(connectors.TreeRtcServiceEventsConnector)
]).pipe(
rxjs.first(),
rxjs.switchMap(([topology, names]) => rxjs.combineLatest([
topology.members$,
names.identityChanges$.pipe(rxjs.startWith(undefined))
]).pipe(rxjs.map(([members]) => ['You', ...members.map(id => names.getDisplayName(id))]))),
rxjs.takeUntil(destroy$)
).subscribe(list => {
root.replaceChildren(...list.map(name => {
const item = document.createElement('li');
item.textContent = name;
return item;
}));
});
}