Created
November 20, 2017 16:48
-
-
Save BeauBouchard/e69d4d8acc772ffb02b4508c00431731 to your computer and use it in GitHub Desktop.
discover rooms for a given socket.io connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findRooms() { | |
var availableRooms = []; | |
var rooms = io.sockets.adapter.rooms; | |
if (rooms) { | |
for (var room in rooms) { | |
if (!rooms[room].hasOwnProperty(room)) { | |
availableRooms.push(room); | |
} | |
} | |
} | |
return availableRooms; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment