문서 모음

NodeJS 관련 파일 186

고수석 2019. 4. 18. 18:50

//////////////////////////////////////////////////////////////////

// 룸에 대한 정보 객체를 받음.

function getRoomList() {

    console.log('getRoomList 호출됨');

    console.log('ROOMS-> ' + JSON.stringify(io.sockets.adapter.rooms));

    

    var rooms = [];

    

    Object.keys(io.sockets.adapter.rooms).forEach(function(roomId) {

        console.log('현재 방 ID :' + roomId);

        var curRoom = io.sockets.adapter.rooms[roomId];

        

        var found = false;

        Object.keys(curRoom.sockets).forEach(function(key){

            if(roomId == key) {

                found = true;

            }

        });

        

        if(!found) {

            rooms.push(curRoom);

        }

    });

}

'문서 모음' 카테고리의 다른 글

NodeJS 관련 파일 53  (0) 2019.04.18
NodeJS 관련 파일 135  (0) 2019.04.18
Json 을 이용한 Unity 파싱.  (0) 2019.03.22
Gamification 관련  (0) 2018.08.04
MongoDB 간단 쿼리  (0) 2017.02.15