SendData API & publishData permission (#88)

* SendData Server API

* SendData Server-API adjustments based on suggestions

* Update proto version

* enforce publishData permission

* go mod tidy

* fix go.mod

* go mod tidy

Co-authored-by: ChesterMing <89124853+ChesterMing@users.noreply.github.com>
This commit is contained in:
David Zhao
2021-08-19 18:11:48 -07:00
committed by GitHub
co-authored by ChesterMing
parent 2ab37d8fcc
commit bcf6e15e07
15 changed files with 163 additions and 59 deletions
+24
View File
@@ -454,6 +454,30 @@ func TestDataChannel(t *testing.T) {
require.Equal(t, 1, p1.SendDataPacketCallCount())
require.Equal(t, packet.Value, p1.SendDataPacketArgsForCall(0).Value)
})
t.Run("publishing disallowed", func(t *testing.T) {
rm := newRoomWithParticipants(t, testRoomOpts{num: 2})
defer rm.Close()
participants := rm.GetParticipants()
p := participants[0].(*typesfakes.FakeParticipant)
p.CanPublishDataReturns(false)
packet := livekit.DataPacket{
Kind: livekit.DataPacket_RELIABLE,
Value: &livekit.DataPacket_User{
User: &livekit.UserPacket{
Payload: []byte{},
},
},
}
p.OnDataPacketArgsForCall(0)(p, &packet)
// no one should've been sent packet
for _, op := range participants {
fp := op.(*typesfakes.FakeParticipant)
require.Zero(t, fp.SendDataPacketCallCount())
}
})
}
func TestHiddenParticipants(t *testing.T) {