This method allows you send your extra-data to nodejs so that it can be shared with all connected users
Share extra information among all participants using connection.extra object.
"updateExtraData" allows you update extra information any time, during live session.
onExtraDataUpdated is fired for all participants as soon as someone updates extra information.
connection.extra.modifiedValue = 'new value'; connection.updateExtraData(); connection.onExtraDataUpdated = function(event) { var modifiedValue = event.extra.modifiedValue; var whoModified = event.userid; // or event.extra.fullName };
<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script> <script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script> <script> var connection = new RTCMultiConnection(); // this line is VERY_important connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/'; // if you want audio+video conferencing connection.session = { audio: true, video: true }; connection.extra = { joinedAt: (new Date).toISOString() }; connection.onstream = function(event) { document.body.appendChild(event.mediaElement); if (event.type === 'remote') { var heJoinedAt = new Date(event.extra.joinedAt).getTime(); var currentDate = new Date().getTime(); var latency = currentDate - heJoinedAt; } }; btnUpdateExtra.onclick = function() { connection.extra.modifiedValue = new Date(); // new value connection.updateExtraData(); }; connection.onExtraDataUpdated = function(event) { var modifiedValue = event.extra.modifiedValue; var whoModified = event.userid; // or event.extra.fullName alert(whoModified + ' modified ' + modifiedValue); }; connection.openOrJoin('your-room-id'); </script>