OpenTera WebRTC API (JavaScript) 1.2.6
Public Member Functions | List of all members
WebrtcClient Class Reference

Represents the base class of DataChannelClient, StreamClient and StreamDataChannelClient. More...

Inheritance diagram for WebrtcClient:
DataChannelClient StreamClient StreamDataChannelClient

Public Member Functions

 constructor (signalingServerConfiguration, logger)
 Creates a signaling client with the specified configurations. More...
 
 _connectSignalingClientCallbacks ()
 
async connect ()
 Connects the client the signaling server. More...
 
 _disconnect ()
 
async _peerCallReceived (data)
 
async _peerCallAnswerReceived (data)
 
async _addIceCandidate (data)
 
async _makePeerCall (ids)
 
async _getCallAcceptance (id)
 
 _connectRtcPeerConnectionEvents (id, rtcPeerConnection)
 
 _disconnectRtcPeerConnectionEvents (rtcPeerConnection)
 
 _removeConnection (id, callOnClientDisconnect)
 
 _addConnectionStateToClients (clients)
 
 _updateClientNamesById (clients)
 
 _updateClientDatumById (clients)
 
 _hasRtcPeerConnection (id)
 
 _getAllRtcPeerConnection ()
 
 _closeAllRtcPeerConnections ()
 
 updateRoomClients ()
 
 close ()
 Closes all client connections.
 
 callAll ()
 Calls all room clients.
 
 callIds (ids)
 Calls the specified clients. More...
 
 hangUpAll ()
 Hangs up all clients.
 
 closeAllRoomPeerConnections ()
 Closes all room peer connections.
 
 getClientName (id)
 Gets the client name from the client id. More...
 
 getClientData (id)
 Gets the client data from the client id. More...
 
get isConnected ()
 Indicates if the client is connected to the signaling server. More...
 
get isRtcConnected ()
 Indicates if the client is connected to at least one client (RTCPeerConnection). More...
 
get id ()
 Returns the client id. More...
 
get connectedRoomClientIds ()
 Returns the connected room client ids. More...
 
get roomClients ()
 Returns the room clients. More...
 
set onSignalingConnectionOpen (onSignalingConnectionOpen)
 Sets the callback that is called when the signaling connection opens. More...
 
set onSignalingConnectionClose (onSignalingConnectionClose)
 Sets the callback that is called when the signaling connection closes. More...
 
set onSignalingConnectionError (onSignalingConnectionError)
 Sets the callback that is called when a signaling connection error occurs. More...
 
set onRoomClientsChange (onRoomClientsChange)
 Sets the callback that is called when the room client changes. More...
 
set callAcceptor (callAcceptor)
 Sets the callback that is used to accept or reject a call. More...
 
set onCallReject (onCallReject)
 Sets the callback that is called when a call is rejected. More...
 
set onClientConnect (onClientConnect)
 Sets the callback that is called when a client peer connection opens. More...
 
set onClientDisconnect (onClientDisconnect)
 Sets the callback that is called when a client peer connection closes. More...
 
set onClientConnectionFail (onClientConnectionFail)
 Sets the callback that is called when a client peer connection fails. More...
 

Detailed Description

Represents the base class of DataChannelClient, StreamClient and StreamDataChannelClient.

Member Function Documentation

◆ callAcceptor()

set WebrtcClient::callAcceptor (   callAcceptor)
inline

Sets the callback that is used to accept or reject a call.

Callback parameters:

  • clientId: The client id
  • clientName: The client name
  • clientData: The client data

Callback return value:

  • true to accept the call, false to reject the call
Parameters
{CallableFunction}callAcceptor The callback

◆ callIds()

WebrtcClient::callIds (   ids)
inline

Calls the specified clients.

Parameters
{Array<String>}ids The client ids to call

◆ connect()

async WebrtcClient::connect ( )
inline

Connects the client the signaling server.

Returns
{Promise<void>}

◆ connectedRoomClientIds()

get WebrtcClient::connectedRoomClientIds ( )
inline

Returns the connected room client ids.

Returns
{Array<String>} The connected room client ids

◆ constructor()

WebrtcClient::constructor (   signalingServerConfiguration,
  logger 
)
inline

Creates a signaling client with the specified configurations.

Parameters
{Object}signalingServerConfiguration The signaling server configuration
{
url: 'signaling server URL',
name: 'client name',
data: {}, // Client custom data
room: 'room name',
password: 'password'
}
{CallableFunction}logger An optional logger callback

◆ getClientData()

WebrtcClient::getClientData (   id)
inline

Gets the client data from the client id.

Parameters
{String}id The client id
Returns
{Object} The client name

◆ getClientName()

WebrtcClient::getClientName (   id)
inline

Gets the client name from the client id.

Parameters
{String}id The client id
Returns
{String} The client name

◆ id()

get WebrtcClient::id ( )
inline

Returns the client id.

Returns
{String} The client id

◆ isConnected()

get WebrtcClient::isConnected ( )
inline

Indicates if the client is connected to the signaling server.

Returns
{Boolean} true if the client is connected to the signaling server

◆ isRtcConnected()

get WebrtcClient::isRtcConnected ( )
inline

Indicates if the client is connected to at least one client (RTCPeerConnection).

Returns
{Boolean} true if the client is connected to at least one client (RTCPeerConnection)

◆ onCallReject()

set WebrtcClient::onCallReject (   onCallReject)
inline

Sets the callback that is called when a call is rejected.

Callback parameters:
  • clientId: The client id
  • clientName: The client name
  • clientData: The client data
Parameters
{CallableFunction}onCallReject The callback

◆ onClientConnect()

set WebrtcClient::onClientConnect (   onClientConnect)
inline

Sets the callback that is called when a client peer connection opens.

Callback parameters:
  • clientId: The client id
  • clientName: The client name
  • clientData: The client data
Parameters
{CallableFunction}onClientConnect The callback

◆ onClientConnectionFail()

set WebrtcClient::onClientConnectionFail (   onClientConnectionFail)
inline

Sets the callback that is called when a client peer connection fails.

Callback parameters:
  • clientId: The client id
  • clientName: The client name
  • clientData: The client data
Parameters
{CallableFunction}onClientConnectionFail The callback

◆ onClientDisconnect()

set WebrtcClient::onClientDisconnect (   onClientDisconnect)
inline

Sets the callback that is called when a client peer connection closes.

Callback parameters:
  • clientId: The client id
  • clientName: The client name
  • clientData: The client data
Parameters
{CallableFunction}onClientDisconnect The callback

◆ onRoomClientsChange()

set WebrtcClient::onRoomClientsChange (   onRoomClientsChange)
inline

Sets the callback that is called when the room client changes.

Callback parameter:
  • clients: The room clients
Parameters
{CallableFunction}onRoomClientsChange The callback

◆ onSignalingConnectionClose()

set WebrtcClient::onSignalingConnectionClose (   onSignalingConnectionClose)
inline

Sets the callback that is called when the signaling connection closes.

Callback parameter: None
Parameters
{CallableFunction}onSignalingConnectionClose The callback

◆ onSignalingConnectionError()

set WebrtcClient::onSignalingConnectionError (   onSignalingConnectionError)
inline

Sets the callback that is called when a signaling connection error occurs.

Callback parameter:
  • error: The error message
Parameters
{CallableFunction}onSignalingConnectionError The callback

◆ onSignalingConnectionOpen()

set WebrtcClient::onSignalingConnectionOpen (   onSignalingConnectionOpen)
inline

Sets the callback that is called when the signaling connection opens.

Callback parameter: None
Parameters
{CallableFunction}onSignalingConnectionOpen The callback

◆ roomClients()

get WebrtcClient::roomClients ( )
inline

Returns the room clients.

Returns
{Array<Object>} An array of client objects

The documentation for this class was generated from the following file: