Skip to content

Introduction

This document is ECLWebRTC JavaScript SDK API Reference. See Communication model of ECLWebRTC if this is the first time for you to develop applciation with ECLWebRTC.

About class

A list of the classes described in this document.

About EventEmitter

All classes above inherit EventEmitter.

Therefore, methods such as on(), off(), and emit() are available.

function onOpen() {
  console.log('an open event occurred!');
}

// add listener
peer.on('open', onOpen);
// remove listener
peer.off('open', onOpen)

// custom events
peer.on('myev', val => {
  console.log(val); // 3
})
peer.emit('myev', 3);

For API details, see the document of EventEmitter.

For events details, see the document of each class.

Set a listener for 'error' event is always recommended to avoid unexpected behavior.