Refactor transportclose 13
This commit is contained in:
parent
6d8f22939a
commit
01fec638c9
24
app.js
24
app.js
@ -159,8 +159,9 @@ peers.on('connection', async socket => {
|
||||
|
||||
producer.on('transportclose', () => {
|
||||
console.log('transport for this producer closed ')
|
||||
producer.close()
|
||||
delete router[callId]
|
||||
closeRoom(callId)
|
||||
// producer.close()
|
||||
// delete router[callId]
|
||||
})
|
||||
|
||||
// Send back to the client the Producer's id
|
||||
@ -191,7 +192,8 @@ peers.on('connection', async socket => {
|
||||
|
||||
consumer.on('transportclose', () => {
|
||||
console.log('transport close from consumer', callId)
|
||||
delete router[callId]
|
||||
closeRoom(callId)
|
||||
// delete router[callId]
|
||||
})
|
||||
|
||||
consumer.on('producerclose', () => {
|
||||
@ -276,3 +278,19 @@ const createWebRtcTransportLayer = async (callId, callback) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const 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
|
||||
delete router[callId]
|
||||
}
|
Loading…
Reference in New Issue
Block a user