Skip to content

Instantly share code, notes, and snippets.

@Shadid12
Created June 30, 2019 19:37
Show Gist options
  • Save Shadid12/bd8a430d1d5de6b6105a846475811612 to your computer and use it in GitHub Desktop.
Save Shadid12/bd8a430d1d5de6b6105a846475811612 to your computer and use it in GitHub Desktop.
//public/index.js
...
var answersFrom = {}, offer;
socket.on('answer-made', function (data) {
pc.setRemoteDescription(new sessionDescription(data.answer), function () {
document.getElementById(data.socket).setAttribute('class', 'active');
if (!answersFrom[data.socket]) {
createOffer(data.socket);
answersFrom[data.socket] = true;
}
}, error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment