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... | |
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.
| WebRTCDataChannels::WebRTCDataChannels | ( | QObject * | parent | ) |
Constructs a new WebRTCDataChannels object.
| parent | The parent Qt object. |
| 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.
| connection | The WebRTC data channel connection. |
|
slot |
Closes the peer connection for a WebRTC data channel.
Used by WebRTCDataChannels.closePeerConnection.
| connection | The WebRTC data channel connection. |
|
signal |
Signals that the peer connection for a WebRTC data channel should be closed.
Used by WebRTCDataChannels.closePeerConnection.
| connection | The WebRTC data channel connection. |
| rtc::scoped_refptr< PeerConnectionInterface > WebRTCDataChannels::createPeerConnection | ( | const std::shared_ptr< WDCPeerConnectionObserver > | peerConnectionObserver | ) |
Creates a new WebRTC peer connection for connecting to an Interface client.
| peerConnectionObserver | An observer to monitor the WebRTC peer connection. |
|
signal |
A WebRTC data message received from the Interface client.
This message is for handling at a higher level in the Overte protocol.
| address | The address of the signaling WebSocket that the client used to connect. |
| byteArray | The Overte protocol message. |
| void WebRTCDataChannels::emitDataMessage | ( | const QString & | dataChannelID, |
| const QByteArray & | byteArray | ||
| ) |
Emits a dataMessage received from the Interface client.
| dataChannelID | The IP address and port of the signaling WebSocket that the client used to connect, "n.n.n.n:n". |
| byteArray | The data message received. |
| qint64 WebRTCDataChannels::getBufferedAmount | ( | const SockAddr & | address | ) | const |
Gets the number of bytes waiting to be sent on a data channel.
| address | The address of the signaling WebSocket that the client used to connect. |
|
inline |
Gets the type of node that the WebRTCDataChannels object is being used in.
| void WebRTCDataChannels::onDataChannelOpened | ( | WDCConnection * | connection, |
| const QString & | dataChannelID | ||
| ) |
Handles a WebRTC data channel opening.
| connection | The WebRTC data channel connection. |
| dataChannelID | The IP address and port of the signaling WebSocket that the client used to connect, "n.n.n.n:n". |
|
slot |
Handles a WebRTC signaling message received from the Interface client.
| message | The WebRTC signaling message. |
| bool WebRTCDataChannels::sendDataMessage | ( | const SockAddr & | destination, |
| const QByteArray & | message | ||
| ) |
Sends a data message to an Interface client.
| dataChannelID | The IP address and port of the signaling WebSocket that the client used to connect, "n.n.n.n:n". |
| message | The data message to send. |
true if the data message was sent, otherwise false. | void WebRTCDataChannels::sendSignalingMessage | ( | const QJsonObject & | message | ) |
Emits a signalingMessage to be sent to the Interface client.
| message | The WebRTC signaling message to send. |
|
signal |
A WebRTC signaling message to be sent to the Interface client.
This message is for the WebRTCSignalingServer to send.
| message | The WebRTC signaling message to send. |