Home Reference Source

lib/messages/mrequest.js

'use strict'

/**
 * The message containing the request to create a WebRTC connexion
 */
class MRequest {
  /**
     * @param {string} temporaryId A temporary identifier during the socket
     * creation. The key will be changed to peerId when the connexion is
     * established successfully.
     * @param {string} peerId The identifier of the peer that will be reachable
     * through the socket being created. Null if it is yet to be known.
     * @param {object} offer The WebRTC offer containing ways to establish a
     * direct peer-to-peer connexions. See WebRTC for more information.
     */
  constructor (temporaryId, peerId, offer, offerType = 'init') {
    this.tid = temporaryId
    this.peer = peerId
    this.offer = offer
    this.type = 'MRequest'
    this.offerType = offerType
  }
}

module.exports = MRequest