Connect to mediasoup with timeout(fix when it appears offline)

This commit is contained in:
Sergiu Toma 2022-11-22 18:27:56 +02:00
parent 39ad9cad27
commit b621b76e37

View File

@ -37,6 +37,7 @@ const connectToMediasoup = () => {
} }
if (IS_PRODUCER === true) { if (IS_PRODUCER === true) {
setTimeout(() => {
hub.on('connect', async () => { hub.on('connect', async () => {
console.log(`[HUB] ${config.hubAddress} | connected: ${hub.connected}`) console.log(`[HUB] ${config.hubAddress} | connected: ${hub.connected}`)
connectToMediasoup() connectToMediasoup()
@ -70,6 +71,7 @@ if (IS_PRODUCER === true) {
} }
}) })
}) })
}, 2000);
hub.on('connect_error', (error) => { hub.on('connect_error', (error) => {
console.log('connect_error', error); console.log('connect_error', error);