rtc.RemotePeer Class
Represents a remote user of the room
Constructor
rtc.RemotePeer
-
peer_connection -
signaling -
local -
options
Parameters:
-
peer_connectionrtc.PeerConnectionThe underlying peer connection
-
signalingrtc.SignalingPeerThe signaling connection to the peer
-
localrtc.LocalPeerThe local peer
-
optionsObjectThe options object as passed to
Room
Item Index
Properties
Methods
addDataChannel
-
[name='data'] -
[desc={ordered: true}]
Add data channel which will be negotiated with this remote peer
If you use this method you have to set auto_connect to false in the options object and call connect() manually on all remote peers.
Parameters:
-
[name='data']String optionalName of the data channel
-
[desc={ordered: true}]Object optionalOptions passed to
RTCDataChannel.createDataChannel()
addStream
-
[name='stream'] -
stream
Add local stream to be sent to this remote peer
If you use this method you have to set auto_connect to false in the options object and call connect() manually on all remote peers.
Parameters:
-
[name='stream']String optionalName of the stream
-
streamPromise -> rtc.Stream | rtc.Stream | ObjectThe stream, a promise to the stream or the configuration to create a stream with
rtc.Stream.createStream()
Returns:
Promise of the stream which was added
channel
-
[name='data']
Get a data channel to the remote peer. Has to be added by local and remote side to succeed.
Parameters:
-
[name='data']String optionalName of the data channel
Returns:
Promise of the data channel
close
()
Closes the connection to the peer
connect
()
Promise
Connect to the remote peer to exchange streams and create data channels
Returns:
Promise which will resolved when the connection is established
isLocal
()
Boolean
Checks whether the peer is the local peer. Returns always false on this
class.
Returns:
Returns false
message
-
data
Send a message to the peer through signaling
Parameters:
-
dataObjectThe payload
Returns:
Promise which is resolved when the data was sent
status
-
key
Get a value of the status object
Parameters:
-
keyStringThe key
Returns:
The value
stream
-
[name='stream']
Get a stream from the peer. Has to be sent by the remote peer to succeed.
Parameters:
-
[name='stream']String optionalName of the stream
Returns:
Promise of the stream
Properties
signaling
rtc.signaling.SignalingPeer
The connection to the peer supplied by the signaling implementation
Events
data_channel_added
-
name -
channel
A new data channel is available from the peer
Parameters:
-
nameStringName of the channel
-
channelPromise -> rtc.DataChannelPromise of the channel
left
()
The remote peer left or signaling closed
message
-
data
Message received from peer through signaling
Parameters:
-
dataObjectThe payload of the message
status_changed
-
status
The status of the peer has changed
Parameters:
-
statusObjectThe new status object
stream_added
-
name -
stream
A new stream is available from the peer
Parameters:
-
nameStringName of the stream
-
streamPromise -> rtc.StreamPromise of the stream
