Skip to content

Commit

Permalink
Use participant identity when sending data (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidzhao authored Jul 6, 2024
1 parent a261361 commit 1304ef8
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions cmd/lk/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ import (
"strings"
"syscall"

"github.com/livekit/protocol/logger"
"github.com/pion/webrtc/v3"
"github.com/urfave/cli/v3"
"google.golang.org/protobuf/encoding/protojson"

"github.com/livekit/protocol/logger"

"github.com/livekit/protocol/livekit"
lksdk "github.com/livekit/server-sdk-go/v2"
)
Expand Down Expand Up @@ -274,13 +275,8 @@ var (
Usage: "`TOPIC` of the message",
},
&cli.StringSliceFlag{
Hidden: true, // deprecated: use `--participant-ids`
Name: "participantID",
Usage: "list of participantID to send the message to",
},
&cli.StringSliceFlag{
Name: "participant-ids",
Usage: "List of participant `ID`s to send the message to",
Name: "identity",
Usage: "One or more participant identities to send the message to. When empty, broadcasts to the entire room",
},
},
},
Expand Down Expand Up @@ -495,10 +491,6 @@ var (
Name: "participantID",
Usage: "list of participantID to send the message to",
},
&cli.StringSliceFlag{
Name: "participant-ids",
Usage: "List of participant `ID`s to send the message to",
},
},
},
}
Expand Down Expand Up @@ -978,16 +970,18 @@ func updateSubscriptions(ctx context.Context, cmd *cli.Command) error {

func sendData(ctx context.Context, cmd *cli.Command) error {
roomName, _ := participantInfoFromFlags(cmd)
pIDs := cmd.StringSlice("participantID")
identities := cmd.StringSlice("identity")
data := cmd.String("data")
if data == "" {
data = cmd.Args().First()
}
topic := cmd.String("topic")
req := &livekit.SendDataRequest{
Room: roomName,
Data: []byte(data),
DestinationSids: pIDs,
Room: roomName,
Data: []byte(data),
DestinationIdentities: identities,
// deprecated
DestinationSids: cmd.StringSlice("participantID"),
}
if topic != "" {
req.Topic = &topic
Expand Down

0 comments on commit 1304ef8

Please sign in to comment.