From 0f1c268fa5a529e9ab14e8d1f40ac632a5569f5a Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Thu, 11 Aug 2022 14:40:40 +0300 Subject: [PATCH] Refactor transportclose 11 --- app.js | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/app.js b/app.js index ddaac56..66c4be8 100644 --- a/app.js +++ b/app.js @@ -160,6 +160,7 @@ peers.on('connection', async socket => { producer.on('transportclose', () => { console.log('transport for this producer closed ') producer.close() + router[callId] = null }) // Send back to the client the Producer's id @@ -190,10 +191,11 @@ peers.on('connection', async socket => { consumer.on('transportclose', () => { console.log('transport close from consumer', callId) + router[callId] = null }) consumer.on('producerclose', () => { - console.log('producer of consumer closed', callId) + console.log('producer of consumer closed') }) // from the consumer extract the following params @@ -224,23 +226,6 @@ peers.on('connection', async socket => { }) }) -const closeRoom = (callId) => { - console.log('closeRoom', callId); - // Close transport for producer/consumer - // https://mediasoup.org/documentation/v3/mediasoup-client/api/#Transport-methods - producerTransport.close() - consumerTransport.close() - - // Close producer and consumer - // https://mediasoup.org/documentation/v3/mediasoup-client/api/#producer-close - // https://mediasoup.org/documentation/v3/mediasoup-client/api/#consumer-closed - producer.close() - consumer.close() - - // Reset room - router[callId] = null -} - const createWebRtcTransportLayer = async (callId, callback) => { try { // https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtcTransportOptions