Skip to content

Commit 3a4c7c4

Browse files
committed
feat(rooms): forward participant
1 parent 817558d commit 3a4c7c4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

cmd/lk/room.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,20 @@ var (
201201
roomFlag,
202202
},
203203
},
204+
{
205+
Name: "forward",
206+
Usage: "Forward a participant to a different room",
207+
Before: createRoomClient,
208+
Action: forwardParticipant,
209+
Flags: []cli.Flag{
210+
roomFlag,
211+
identityFlag,
212+
&cli.StringFlag{
213+
Name: "destination-room",
214+
Usage: "`NAME` of the destination room",
215+
},
216+
},
217+
},
204218
{
205219
Name: "update",
206220
Usage: "Change the metadata and permissions for a room participant",
@@ -1020,6 +1034,27 @@ func removeParticipant(ctx context.Context, cmd *cli.Command) error {
10201034
return nil
10211035
}
10221036

1037+
func forwardParticipant(ctx context.Context, cmd *cli.Command) error {
1038+
roomName, identity := participantInfoFromArgOrFlags(cmd)
1039+
destinationRoomName := cmd.String("destination-room")
1040+
if destinationRoomName == "" {
1041+
return fmt.Errorf("destination-room is required")
1042+
}
1043+
1044+
_, err := roomClient.ForwardParticipant(ctx, &livekit.ForwardParticipantRequest{
1045+
Room: roomName,
1046+
Identity: identity,
1047+
DestinationRoom: destinationRoomName,
1048+
})
1049+
if err != nil {
1050+
return err
1051+
}
1052+
1053+
fmt.Println("successfully forwarded participant", identity, "from", roomName, "to", destinationRoomName)
1054+
1055+
return nil
1056+
}
1057+
10231058
func muteTrack(ctx context.Context, cmd *cli.Command) error {
10241059
roomName, identity := participantInfoFromFlags(cmd)
10251060
muted := cmd.Bool("mute") || !cmd.Bool("unmute")

0 commit comments

Comments
 (0)