Skip to main content

Connected Users

The collab client comes with support for viewing all users who are viewing a specific document.

In order to get connected users, you must turn on enableConnectedUsers in the client constructor:

const client = new CollabClient({
...otherOptions,
enableConnectedUsers: true
})

getConnectedUsers#

To get connected users, you can use the Document.getConnectedUsers() function:

document.getConnectedUsers(documentId: string): Promise<User[]>

This function resolves to an array of Users. Each user object has a pageNumber property that represents which page the user is looking at.

Connected users changed event#

You can also subscribe to the connectedUsersChanged event to get notified when connected users page number changed or becomes online/offline.