diff --git a/public/index.js b/public/index.js index 4db5e57..a8e748b 100644 --- a/public/index.js +++ b/public/index.js @@ -15,7 +15,12 @@ hub = io(config.hubAddress) const connectToMediasoup = () => { - socket = io(config.mediasoupAddress) + socket = io(config.mediasoupAddress, { + reconnection: true, + reconnectionDelay: 1000, + reconnectionDelayMax : 5000, + reconnectionAttempts: Infinity + }) socket.on('connection-success', ({ _socketId, existsProducer }) => { console.log(`[MEDIA] ${config.mediasoupAddress} | connected: ${socket.connected} | existsProducer: ${existsProducer}`) @@ -63,6 +68,10 @@ if (IS_PRODUCER === true) { socket.emit('transportclose') consumer = null producer = null + producerTransport = null + consumerTransport = null + device = null + socket.destroy() } }) })