Hi,
I was testing the example 04-create-or-join-room
from colyseus-examples
. I added some console.log
s around and I noticed that requestJoin
is not behaving as I would expect.
Always referring to that example, if I ask to create one room from client client.join('create_or_join', { create: true })
, I see one requestJoin
, with option.create
and isNewRoom
both set to true
. So far so good. Then using another client (or browser tab, the outcome is the same in both cases), I ask to join client.join('create_or_join')
. I see that requestJoin
is called twice for the same roomId
(I assume that means the same CreateOrJoinRoom
instance), both times with option.create
set to undefined
, as expected, and with isNewRoom
set to false
. Then I see one onJoin
event associated to that roomId
. colyseus/monitor lists one room with two clients connected.
The question is: why is requestJoin
called twice? The first (and only one) instance is never being locked and maxClient
is set to 4
. Funny thing, both requestJoin
s return true
.
I'm not sure I fully understood rooms and their interactions with clients, but I really want to make sure this is not a colyseus issue that might influence other parts of the code.