From 19305490a3a58fdac96607196b4a9e8c7b306dc9 Mon Sep 17 00:00:00 2001 From: jungeun Date: Thu, 10 Oct 2024 18:10:44 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20server.js=20=EC=98=88=EC=99=B8?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/server.js b/server.js index 8d42aa6..50df98e 100644 --- a/server.js +++ b/server.js @@ -164,8 +164,6 @@ async function runWebServer() { }); }); - - // await new Promise((resolve) => { // webServer.listen(listenPort, listenIp, () => { // const listenIps = config.mediasoup.webRtcTransport.listenIps[0]; @@ -306,11 +304,18 @@ async function runSocketServer() { }); socket.on('createProducerTransport', async (data, callback) => { - if (!socket.room) { - callback({ error: 'Not in a room' }); - return; - } + // 콜백이 함수인지 확인 try { + if (typeof callback !== 'function') { + console.error('createProducerTransport called without a valid callback'); + return; + } + + if (!socket.room) { + callback({ error: 'Not in a room' }); + return; + } + const room = roomManager.getRoom(socket.room); const { transport, params } = await createWebRtcTransport(room.router); socket.producerTransport = transport;