From e57cb9489291a1a1c641ba84e7098f6d9bd6806e Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 3 Oct 2022 12:35:45 +0300 Subject: [PATCH] Added callback for 'transport-produce' --- app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 5b8f072..1a3ac3d 100644 --- a/app.js +++ b/app.js @@ -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}`); }