100ms Logo

100ms

Docs

Search docs
/

Change User Name

Any peer can change their own name before or after joining a room. Before joining, the name would have to be specified in HMSConfig that is passed to the join method. This document shows how the name can be changed after joining.

Responding to name changes

Whenever a remote peer's name is changed a callback will be received in onPeerUpdate where the update will be of type HMSPeerUpdate.NAME_CHANGED. When this callback is received the UI for that peer should be updated as well.

Changing the name

The peer who wants to change their name should call the following method on an HMSSdk instance.

const newName: string = "new name" // hms instance acquired by build method await hmsInstance.changeName(newName) .then(d => console.log('Change Name Success: ', d)) .catch(e => console.log('Change Name Error: ', e));