rtc.Room Class
A virtual room which connects multiple Peers
Constructor
rtc.Room
-
name
-
signaling
-
[options]
Parameters:
-
name
StringThe name of the room. Will be passed on to signaling
-
signaling
rtc.Signaling | StringThe signaling to be used. If you pass a string it will be interpreted as a websocket address and a palava signaling connection will be established with it.
-
[options]
Object optionalVarious options to be used in connections created by this room
-
[auto_connect=true]
Boolean optionalWhether remote peers are connected automatically or an explicit
RemotePeer.connect()
call is needed -
[stun]
String optionalThe URI of the STUN server to use
-
[local]
rtc.LocalPeer optionalThe local user
-
Item Index
Methods
Methods
create_peer
-
pc
-
signaling_peer
Creates a remote peer. Overwrite to use your own class for peers.
Parameters:
-
pc
rtc.PeerConnectionThe PeerConnection to the peer
-
signaling_peer
rtc.SignalingPeerThe signaling connection to the peer
join
()
Promise
Joins the room. Initiates connection to signaling server if not done before.
Returns:
A promise which will be resolved once the room was joined
leave
()
Leaves the room and closes all established peer connections
leave
()
Cleans up all resources used by the room.
Properties
signaling
rtc.signaling.Signaling
The underlying signaling implementation as provided in constructor
Events
closed
()
The connection to the room was closed
peer_jopined
-
peer
A new peer is encountered in the room. Fires on new remote peers after joining and for all peers in the room when joining.
Parameters:
-
peer
rtc.RemotePeerThe new peer
peer_status_changed
-
peer
-
status
A peer changed its status.
Parameters:
-
peer
rtc.RemotePeerThe peer which changed its status
-
status
ObjectThe new status