Is it possible to get rooms which socket is currently in, without calling
io.sockets.clients(roomName)
for every room name and looking for
Version 1.7.3, socket.rooms contains socket.id, so remove it and get the list of rooms:
socket.rooms
socket.id
Object.keys(socket.rooms).filter(item => item!=socket.id);
In other version, you can print the socket and find the rooms.
socket