Skip to content

Commit afc6c68

Browse files
committed
update add participant code snippet for JS
1 parent 86fd82f commit afc6c68

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

articles/communication-services/quickstarts/rooms/includes/rooms-quickstart-javascript.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,21 @@ const updateRoom = await roomsClient.updateRoom(roomId, updateRoomRequest);
109109

110110
### Add new participants
111111

112-
To add new participants to a `room`, issue an update request on the room's `Participants`:
112+
To add new participants to a `room`, use the `addParticipants` method exposed on the client.:
113113

114114
```javascript
115-
const updateRoomRequest = {
116-
roomJoinPolicy: "CommunicationServiceUsers",
117-
participants: [
118-
new RoomParticipant(user1.user, "Consumer"),
119-
new RoomParticipant(user2.user, "Presenter"),
120-
],
121-
};
115+
// request payload to add participants
116+
const addParticipantsRequest = {
117+
participants: [
118+
{
119+
id: user1.user,
120+
role: "Consumer",
121+
},
122+
],
123+
};
122124

123-
// updates the specified room with the request payload
124-
const updateRoom = await roomsClient.updateRoom(roomId, updateRoomRequest);
125-
console.log(`Updated Room`);
126-
printRoom(updateRoom);
125+
// add user2 to the room with the request payload
126+
const addParticipants = await roomsClient.addParticipants(roomId, addParticipantsRequest);
127127
```
128128

129129
Participants that have been added to a `room` become eligible to join calls.

0 commit comments

Comments
 (0)