I create a map object and write down the id at the key, the username as the value, everything works fine on the server side, the collection is output to the console, but when I pass it to the client side, it is either not transferred correctly or does not work at all. Everything worked fine with the array. Server:
socket.on('connect user', (userName) => {
//users.push(userName.userConnect);
users.set(id++, userName.userConnect); // map users
console.log(users);
io.emit("users", users); // passing the collection
Client:
const addUserToModalWindow = () => {
const contentWindow = document.querySelector(".usersList");
socket.on('users', (users) => {
for (let user of users) {
console.log(user);
}
});
};
Writes an error: users is not iterable.

