Overte C++ Documentation
WebRTCDataChannels Class Reference

Manages WebRTC data channels on the domain server or an assignment client that Interface clients can connect to. More...

#include <WebRTCDataChannels.h>

Inherits QObject.

Public Slots

void onSignalingMessage (const QJsonObject &message)
 Handles a WebRTC signaling message received from the Interface client. More...
 
void closePeerConnectionNow (WDCConnection *connection)
 Closes the peer connection for a WebRTC data channel. More...
 

Signals

void signalingMessage (const QJsonObject &message)
 A WebRTC signaling message to be sent to the Interface client. More...
 
void dataMessage (const SockAddr &address, const QByteArray &byteArray)
 A WebRTC data message received from the Interface client. More...
 
void closePeerConnectionSoon (WDCConnection *connection)
 Signals that the peer connection for a WebRTC data channel should be closed. More...
 

Public Member Functions

 WebRTCDataChannels (QObject *parent)
 Constructs a new WebRTCDataChannels object. More...
 
 ~WebRTCDataChannels ()
 Destroys a WebRTCDataChannels object.
 
NodeType_t getNodeType ()
 Gets the type of node that the WebRTCDataChannels object is being used in. More...
 
void reset ()
 Immediately closes all connections and resets the socket.
 
void onDataChannelOpened (WDCConnection *connection, const QString &dataChannelID)
 Handles a WebRTC data channel opening. More...
 
void sendSignalingMessage (const QJsonObject &message)
 Emits a signalingMessage to be sent to the Interface client. More...
 
void emitDataMessage (const QString &dataChannelID, const QByteArray &byteArray)
 Emits a dataMessage received from the Interface client. More...
 
bool sendDataMessage (const SockAddr &destination, const QByteArray &message)
 Sends a data message to an Interface client. More...
 
qint64 getBufferedAmount (const SockAddr &address) const
 Gets the number of bytes waiting to be sent on a data channel. More...
 
rtc::scoped_refptr< webrtc::PeerConnectionInterface > createPeerConnection (const std::shared_ptr< WDCPeerConnectionObserver > peerConnectionObserver)
 Creates a new WebRTC peer connection for connecting to an Interface client. More...
 
void closePeerConnection (WDCConnection *connection)
 Initiates closing the peer connection for a WebRTC data channel. More...
 

Detailed Description

Manages WebRTC data channels on the domain server or an assignment client that Interface clients can connect to.

Presents multiple individual WebRTC data channels as a single one-to-many WebRTCDataChannels object. Interface clients may use WebRTC data channels for Overte protocol network communications instead of UDP. A WebRTCSignalingServer is used in the process of setting up a WebRTC data channel between an Interface client and the domain server or assignment client. The Interface client initiates the connection - including initiating the data channel - and the domain server or assignment client responds.

Additionally, for debugging purposes, instead of containing a Overte protocol payload, a WebRTC message may be an echo request. This is bounced back to the client.

A WebRTC data channel is identified by the IP address and port of the client WebSocket that was used when opening the data channel - this is considered to be the WebRTC data channel's address. The IP address and port of the actual WebRTC connection is not used.

Constructor & Destructor Documentation

◆ WebRTCDataChannels()

WebRTCDataChannels::WebRTCDataChannels ( QObject *  parent)

Constructs a new WebRTCDataChannels object.

Parameters
parentThe parent Qt object.

Member Function Documentation

◆ closePeerConnection()

void WebRTCDataChannels::closePeerConnection ( WDCConnection connection)

Initiates closing the peer connection for a WebRTC data channel.

Emits a WebRTCDataChannels.closePeerConnectionSoon signal which is connected to WebRTCDataChannels.closePeerConnectionNow in order to close the peer connection on a new call stack. This is necessary to work around a WebRTC library limitation.

Parameters
connectionThe WebRTC data channel connection.

◆ closePeerConnectionNow

void WebRTCDataChannels::closePeerConnectionNow ( WDCConnection connection)
slot

Closes the peer connection for a WebRTC data channel.

Used by WebRTCDataChannels.closePeerConnection.

Parameters
connectionThe WebRTC data channel connection.

◆ closePeerConnectionSoon

void WebRTCDataChannels::closePeerConnectionSoon ( WDCConnection connection)
signal

Signals that the peer connection for a WebRTC data channel should be closed.

Used by WebRTCDataChannels.closePeerConnection.

Parameters
connectionThe WebRTC data channel connection.

◆ createPeerConnection()

rtc::scoped_refptr< PeerConnectionInterface > WebRTCDataChannels::createPeerConnection ( const std::shared_ptr< WDCPeerConnectionObserver peerConnectionObserver)

Creates a new WebRTC peer connection for connecting to an Interface client.

Parameters
peerConnectionObserverAn observer to monitor the WebRTC peer connection.
Returns
The new WebRTC peer connection.

◆ dataMessage

void WebRTCDataChannels::dataMessage ( const SockAddr &  address,
const QByteArray &  byteArray 
)
signal

A WebRTC data message received from the Interface client.

This message is for handling at a higher level in the Overte protocol.

Parameters
addressThe address of the signaling WebSocket that the client used to connect.
byteArrayThe Overte protocol message.

◆ emitDataMessage()

void WebRTCDataChannels::emitDataMessage ( const QString &  dataChannelID,
const QByteArray &  byteArray 
)

Emits a dataMessage received from the Interface client.

Parameters
dataChannelIDThe IP address and port of the signaling WebSocket that the client used to connect, "n.n.n.n:n".
byteArrayThe data message received.

◆ getBufferedAmount()

qint64 WebRTCDataChannels::getBufferedAmount ( const SockAddr &  address) const

Gets the number of bytes waiting to be sent on a data channel.

Parameters
addressThe address of the signaling WebSocket that the client used to connect.
Returns
The number of bytes waiting to be sent on the data channel.

◆ getNodeType()

NodeType_t WebRTCDataChannels::getNodeType ( )
inline

Gets the type of node that the WebRTCDataChannels object is being used in.

Returns
The type of node.

◆ onDataChannelOpened()

void WebRTCDataChannels::onDataChannelOpened ( WDCConnection connection,
const QString &  dataChannelID 
)

Handles a WebRTC data channel opening.

Parameters
connectionThe WebRTC data channel connection.
dataChannelIDThe IP address and port of the signaling WebSocket that the client used to connect, "n.n.n.n:n".

◆ onSignalingMessage

void WebRTCDataChannels::onSignalingMessage ( const QJsonObject &  message)
slot

Handles a WebRTC signaling message received from the Interface client.

Parameters
messageThe WebRTC signaling message.

◆ sendDataMessage()

bool WebRTCDataChannels::sendDataMessage ( const SockAddr &  destination,
const QByteArray &  message 
)

Sends a data message to an Interface client.

Parameters
dataChannelIDThe IP address and port of the signaling WebSocket that the client used to connect, "n.n.n.n:n".
messageThe data message to send.
Returns
true if the data message was sent, otherwise false.

◆ sendSignalingMessage()

void WebRTCDataChannels::sendSignalingMessage ( const QJsonObject &  message)

Emits a signalingMessage to be sent to the Interface client.

Parameters
messageThe WebRTC signaling message to send.

◆ signalingMessage

void WebRTCDataChannels::signalingMessage ( const QJsonObject &  message)
signal

A WebRTC signaling message to be sent to the Interface client.

This message is for the WebRTCSignalingServer to send.

Parameters
messageThe WebRTC signaling message to send.

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