Node.js SDK - Peer

Home > rainway-sdk-native > Peer

Peer class

A Rainway Peer which is connected to us. These are cached statically and will be automatically cleaned up on disconnect.

Signature:

export declare class Peer 

Properties

PropertyModifiersTypeDescription
externalIdstring
idPeerId
informationPeerInformation | undefinedGets the information for this guest.
requestIdstring

Methods

MethodModifiersDescription
createDataChannel(name, mode)Create a new custom user data channel with a specific peer. This is only valid if we were the one who initiated the connection.
disconnect()Disconnect this peer.
disconnectAll()staticDisconnect all peers.
get(id)staticLooks up a peer by id and returns undefined if the peer is unknown. As peers are registered when they disconnect, a peer you think exists may no longer be present.
getAssert(id)staticGet a given Peer by its ID. Asserts that the peer exists and never returns null.
purge(id)staticRemove a given peer from the cache. You should not need to call this unless you want to force a refresh of peer information.
send(channel, msg)Sends a message to the specified guest.
setPermissions(stream, inputLevel)Sets the stream config for this Peer.