WebRTC

WebRTC

new WebRTC()

WebRTC engine class. Implements a data P2P service that can be used through the HydroCompute library.

Properties:
Name Type Description
MAX_MESSAGE_SIZE number

Maximum size of a WebRTC message.

connectionTime undefined | number

Time when the connection was established.

candidates undefined | Array

Array of candidates for establishing the connection.

connection undefined | RTCPeerConnection

RTCPeerConnection instance.

dataChannel undefined | RTCDataChannel

RTCDataChannel instance.

type string

Type of the WebRTC connection.

results Array

Array to store results.

selfData Array

Array to store self data.

Source:

Methods

(async, static) createAnswer()

Creates the answer for WebRTC.

Source:

(static) createOfferDescription()

Creates the offer description for WebRTC.

Source:

(static) initialize()

Initializes the WebRTC engine.

Source:

(static) onAvailableChannel()

Handles the available channel for WebRTC.

Source:

(static) oncloseHost()

Handles the event when the data channel is closed on the host machine.

Source:

(static) oncloseReceiver()

Handles the event when the data channel is closed on the receiver machine.

Source:

(static) openConnection(answer)

Opens the connection between two peers.

Parameters:
Name Type Description
answer String

The answer.

Source:

(static) restartDataChannel()

Restarts the data channel from a host with an already RTC connection.

Source:

(static) run(res)

Runs the WebRTC engine.

Parameters:
Name Type Description
res Object

The response.

Source:

(static) sendData(data)

Sends data through WebRTC.

Parameters:
Name Type Description
data Object

The data to send.

Source:

(static) setConnection()

Sets the connection for WebRTC.

Source:

(static) setDataChannel()

Sets the a data channel connection for data transfer and receiving.

Source:

(static) setOfferDescription(offer)

Sets the offer description for WebRTC.

Parameters:
Name Type Description
offer *

The offer.

Source:

(static) submitArray(data)

Submits an array of data through WebRTC.

Parameters:
Name Type Description
data Object

The array of data to submit.

Source: