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