Files
livekit-3d/pkg/routing/utils.go
T
Raja Subramanian 3a9009ae12 type definition of room name (#311)
* WIP commit

* update protocol

* Fixing a test and catching one place where casting was missed

* Fix one more spot which need conversion from livekit.RoomName -> string

* do not covert list
2022-01-02 16:49:16 +05:30

23 lines
514 B
Go

package routing
import (
"errors"
"strings"
"github.com/livekit/protocol/livekit"
)
func participantKey(roomName livekit.RoomName, identity livekit.ParticipantIdentity) string {
return string(roomName) + "|" + identity
}
func parseParticipantKey(pkey string) (roomName livekit.RoomName, identity livekit.ParticipantIdentity, err error) {
parts := strings.Split(pkey, "|")
if len(parts) != 2 {
err = errors.New("invalid participant key")
return
}
return livekit.RoomName(parts[0]), parts[1], nil
}