OdinRoom

export class OdinRoom

The OdinRoom class. Use createRoom from OdinClient instance to create a room. The OdinRoom requires a token to connect to a room. OdinClients handles token creation for you, so its easier to just use OdinClient for room creation. Typical procedure is to create an OdinClient instance with an access key and call its createRoom function to create a room with a name and for a user id. Then add event listeners to the room and call join to connect to the room.

Constructor

NameTypeDescription
constructorOdinRoomCreates a new instance of a room with a token. Use OdinClient if you don’t want to manage tokens yourself.

Properties

NameTypeDescription
idstringGets the ID of the room.
ownPeerIdnumberGets the ID of the local peer joined to the room.

Public Methods

NameTypeDescription
addEventListenervoidAdds an event listener to the room for specific events.
closevoidCloses the room and disconnects from the server.
createAudioStreamOdinMediaCreates a local audio stream and adds it to the room. An OdinMedia object will be returned that allows you to send audio data.
joinvoidJoins the room with the given gateway URL and optional user data.
removeEventListenervoidRemoves an event listener from the room for specific events.
sendMessagevoidSends a message to the room.
setEventListenervoidSets a global event listener that received all events, this can be helpful for debugging. Please use addEventListener instead for production code.
updateOwnUserDatavoidUpdates the peer user data of the local peer
updateRoomUserDatavoidUpdates the room user data (for all peers)