Skip to content

Commit

Permalink
feat : server.js 예외처리
Browse files Browse the repository at this point in the history
  • Loading branch information
jsilver01 committed Oct 10, 2024
1 parent 9a257af commit 1930549
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ async function runWebServer() {
});
});



// await new Promise((resolve) => {
// webServer.listen(listenPort, listenIp, () => {
// const listenIps = config.mediasoup.webRtcTransport.listenIps[0];
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1930549

Please sign in to comment.