i need help. I research about this topic too much but i don't find any solution.
We can list all clients of a Room with code below;
io.of('/').in('room').clients((error, clients) => {
if error throw error;
console.log(clients);
});
My question is how can I show this clients
result in a variable.
I tried these solutions: 1)
var list = io.of('/').in('room').clients ((error, clients) => {
if error throw error;
return clients;
}); // didn't work
2)
async function getList() {
return await io.of('/').in('room').clients((error, clients) => {
if error throw error;
return clients;
});
}