to specific room, can not work

Here is my playcanvas project =>PlayCanvas | HTML5 Game Engine

I want to let each room has two players. and if more than two players, they will join ‘room2’. While I just socket.emit(“playerData”, {id:id, players:players}); it can work perfectly. but while I use different room logic. and use code "“room1”),emit(“playerJoined”,newPlayer; this coding seems didn’t emit data to all the players in room1. Here is my glitch link [].

Hope someone can look for me. billion thanks

Hi @Jason_Tsai,

I am not able to open your glitch url, but from the screenshot you shared I think you only subscribe and emit player data to room1?

I think you will need to keep an active list of all the rooms created and the players that have joined each room. Each time a player sends/request data, you should find the room he has joined and broadcast the necessary info to all participants of that room.

Hi Leonidas, thanks for watching. I have room1 and room2 list, but for trouble shooting, I only put room1 ““room1”).emit(“playerData”, { id: id, players: players });” to check if the two players can update each other in room1.

by the way, please check if you can see my glitch project the bellowing link.