Allow participants to create new connection for publishing new tracks (#224)
* Allow participants to create new connection for publishing new tracks new param 'publish=<name>' enables publishing new connection with publish only grants. Also, identity is appended with '#<name>' * Add integration test to duplicate publish only connection Signed-off-by: shishir gowda <shishir@livekit.io> * Reuse token in test and set subscribeGrant to false on publish param Signed-off-by: shishir gowda <shishir@livekit.io> * create auth token with grants Signed-off-by: shishir gowda <shishir@livekit.io> * Signal ice on negotiate in test client Signed-off-by: shishir gowda <shishir@livekit.io> * Update pkg/service/rtcservice.go Co-authored-by: David Zhao <david@davidzhao.com> Co-authored-by: David Zhao <david@davidzhao.com>
This commit is contained in:
@@ -203,6 +203,22 @@ func createRTCClient(name string, port int, opts *testclient.Options) *testclien
|
||||
return c
|
||||
}
|
||||
|
||||
// creates a client and runs against server
|
||||
func createRTCClientWithToken(token string, port int, opts *testclient.Options) *testclient.RTCClient {
|
||||
ws, err := testclient.NewWebSocketConn(fmt.Sprintf("ws://localhost:%d", port), token, opts)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c, err := testclient.NewRTCClient(ws)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
go c.Run()
|
||||
|
||||
return c
|
||||
}
|
||||
func redisClient() *redis.Client {
|
||||
return redis.NewClient(&redis.Options{
|
||||
Addr: "localhost:6379",
|
||||
@@ -220,6 +236,17 @@ func joinToken(room, name string) string {
|
||||
return t
|
||||
}
|
||||
|
||||
func joinTokenWithGrant(name string, grant *auth.VideoGrant) string {
|
||||
at := auth.NewAccessToken(testApiKey, testApiSecret).
|
||||
AddGrant(grant).
|
||||
SetIdentity(name)
|
||||
t, err := at.ToJWT()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
func createRoomToken() string {
|
||||
at := auth.NewAccessToken(testApiKey, testApiSecret).
|
||||
AddGrant(&auth.VideoGrant{RoomCreate: true}).
|
||||
|
||||
Reference in New Issue
Block a user