Added callback for 'transport-produce'

This commit is contained in:
Sergiu Toma 2022-10-03 12:35:45 +03:00
parent c9ee906fc7
commit e57cb94892

7
app.js
View File

@ -229,7 +229,7 @@ peers.on('connection', async socket => {
- For the router with the id callId, we make produce on producerTransport
- Create the handler on producer at the 'transportclose' event
*/
socket.on('transport-produce', async ({ kind, rtpParameters, appData }) => {
socket.on('transport-produce', async ({ kind, rtpParameters, appData }, callback) => {
try {
const callId = socketDetails[socket.id];
@ -257,6 +257,11 @@ peers.on('connection', async socket => {
console.log('transport for this producer closed', callId)
closeCall(callId);
});
// Send back to the client the Producer's id
callback({
id: producer.id
});
} catch (error) {
console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`);
}