Created
October 10, 2019 06:51
-
-
Save SumindaD/9f6c5678c44d81082c7bf38b9d663927 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function createAndSendAnswer(){ | |
| // Create Answer | |
| connection.createAnswer().then( | |
| answer => { | |
| log('Sent The Answer.'); | |
| // Set Answer for negotiation | |
| connection.setLocalDescription(answer); | |
| // Send Answer to other peer | |
| socket.send(JSON.stringify( | |
| { | |
| action: 'onMessage', | |
| type: 'answer', | |
| data: answer, | |
| id: clientId | |
| } | |
| )); | |
| }, | |
| error => { | |
| log('Error when creating an answer.'); | |
| console.error(error); | |
| } | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment