getClientIds
The getClientIds
method is used to access a list of all the connected clients on the path.
getClientIds(): Ids
Note that if you call this method from within the onClientId
method as a client is getting removed, it will still be returned in the list of client Ids
.
Example
This example logs the list of clients being served by the Durable Object every time a synchronization method is handled.
import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
export class MyDurableObject extends WsServerDurableObject {
onMessage() {
console.info('Clients on path: ', this.getClientIds());
}
}
Since
v5.4.0