Skip to content

Commit 30c0dcf

Browse files
authored
feat(rooms): forward participant (#542)
* feat(rooms): forward participant * chore(deps): update * chore(nanpa): add changeset * fix: add ArgsUsage for forward participant * chore(deps): update server-sdk-go
1 parent e457e41 commit 30c0dcf

File tree

4 files changed

+117
-52
lines changed

4 files changed

+117
-52
lines changed

.nanpa/forward-participant.kdl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
minor type="added" "introduce forward participant API for cloud"

cmd/lk/room.go

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

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

go.mod

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ require (
1313
github.com/go-logr/logr v1.4.2
1414
github.com/go-task/task/v3 v3.41.0
1515
github.com/joho/godotenv v1.5.1
16-
github.com/livekit/protocol v1.35.1-0.20250320161708-6d044a0462b3
17-
github.com/livekit/server-sdk-go/v2 v2.5.1-0.20250321175649-e38544bea187
16+
github.com/livekit/protocol v1.36.2-0.20250409063348-18e676b49301
17+
github.com/livekit/server-sdk-go/v2 v2.5.1-0.20250409173856-5949eeff3572
1818
github.com/moby/buildkit v0.20.1
1919
github.com/pion/rtcp v1.2.15
2020
github.com/pion/rtp v1.8.13
@@ -26,17 +26,17 @@ require (
2626
github.com/twitchtv/twirp v8.1.3+incompatible
2727
github.com/urfave/cli/v3 v3.0.0-beta1
2828
go.uber.org/atomic v1.11.0
29-
golang.org/x/sync v0.12.0
29+
golang.org/x/sync v0.13.0
3030
golang.org/x/time v0.10.0
31-
google.golang.org/protobuf v1.36.5
31+
google.golang.org/protobuf v1.36.6
3232
gopkg.in/yaml.v3 v3.0.1
3333
k8s.io/apimachinery v0.32.3
3434
)
3535

3636
require (
37-
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.5-20250307204501-0409229c3780.1 // indirect
38-
buf.build/go/protoyaml v0.3.1 // indirect
39-
cel.dev/expr v0.22.0 // indirect
37+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250307204501-0409229c3780.1 // indirect
38+
buf.build/go/protoyaml v0.3.2 // indirect
39+
cel.dev/expr v0.23.1 // indirect
4040
dario.cat/mergo v1.0.1 // indirect
4141
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
4242
github.com/Ladicle/tabwriter v1.0.0 // indirect
@@ -82,7 +82,7 @@ require (
8282
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
8383
github.com/fatih/color v1.18.0 // indirect
8484
github.com/felixge/httpsnoop v1.0.4 // indirect
85-
github.com/fsnotify/fsnotify v1.8.0 // indirect
85+
github.com/fsnotify/fsnotify v1.9.0 // indirect
8686
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
8787
github.com/gammazero/deque v1.0.0 // indirect
8888
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
@@ -98,7 +98,7 @@ require (
9898
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
9999
github.com/golang/protobuf v1.5.4 // indirect
100100
github.com/google/cel-go v0.24.1 // indirect
101-
github.com/google/go-cmp v0.6.0 // indirect
101+
github.com/google/go-cmp v0.7.0 // indirect
102102
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
103103
github.com/google/uuid v1.6.0 // indirect
104104
github.com/gorilla/websocket v1.5.3 // indirect
@@ -132,14 +132,14 @@ require (
132132
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
133133
github.com/muesli/cancelreader v0.2.2 // indirect
134134
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect
135-
github.com/nats-io/nats.go v1.39.1 // indirect
135+
github.com/nats-io/nats.go v1.41.1 // indirect
136136
github.com/nats-io/nkeys v0.4.10 // indirect
137137
github.com/nats-io/nuid v1.0.1 // indirect
138138
github.com/opencontainers/go-digest v1.0.0 // indirect
139139
github.com/opencontainers/image-spec v1.1.0 // indirect
140140
github.com/pion/datachannel v1.5.10 // indirect
141-
github.com/pion/dtls/v3 v3.0.5 // indirect
142-
github.com/pion/ice/v4 v4.0.8 // indirect
141+
github.com/pion/dtls/v3 v3.0.6 // indirect
142+
github.com/pion/ice/v4 v4.0.9 // indirect
143143
github.com/pion/interceptor v0.1.37 // indirect
144144
github.com/pion/logging v0.2.3 // indirect
145145
github.com/pion/mdns/v2 v2.0.7 // indirect
@@ -155,7 +155,7 @@ require (
155155
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
156156
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
157157
github.com/radovskyb/watcher v1.0.7 // indirect
158-
github.com/redis/go-redis/v9 v9.7.1 // indirect
158+
github.com/redis/go-redis/v9 v9.7.3 // indirect
159159
github.com/rivo/uniseg v0.4.7 // indirect
160160
github.com/sajari/fuzzy v1.0.0 // indirect
161161
github.com/secure-systems-lab/go-securesystemslib v0.4.0 // indirect
@@ -186,15 +186,15 @@ require (
186186
go.uber.org/multierr v1.11.0 // indirect
187187
go.uber.org/zap v1.27.0 // indirect
188188
go.uber.org/zap/exp v0.3.0 // indirect
189-
golang.org/x/crypto v0.36.0 // indirect
190-
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
191-
golang.org/x/net v0.37.0 // indirect
192-
golang.org/x/sys v0.31.0 // indirect
193-
golang.org/x/term v0.30.0 // indirect
194-
golang.org/x/text v0.23.0 // indirect
195-
google.golang.org/genproto/googleapis/api v0.0.0-20250313205543-e70fdf4c4cb4 // indirect
196-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 // indirect
197-
google.golang.org/grpc v1.71.0 // indirect
189+
golang.org/x/crypto v0.37.0 // indirect
190+
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
191+
golang.org/x/net v0.39.0 // indirect
192+
golang.org/x/sys v0.32.0 // indirect
193+
golang.org/x/term v0.31.0 // indirect
194+
golang.org/x/text v0.24.0 // indirect
195+
google.golang.org/genproto/googleapis/api v0.0.0-20250407143221-ac9807e6c755 // indirect
196+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250407143221-ac9807e6c755 // indirect
197+
google.golang.org/grpc v1.71.1 // indirect
198198
gopkg.in/inf.v0 v0.9.1 // indirect
199199
gopkg.in/warnings.v0 v0.1.2 // indirect
200200
mvdan.cc/sh/v3 v3.10.0 // indirect

0 commit comments

Comments
 (0)