Thanks for the quick response and for the heads up about the join issue.
But unfortunately that didn't answer my question. I'll explain my situation more clearly.
I have added one console.log
line to CreateOrJoinRoom.requestJoin
method:
requestJoin (options, isNewRoom: boolean) {
console.log(`roomId: ${this.roomId}, create: ${options.create}, isNewRoom: ${isNewRoom}`);
return (options.create)
? (options.create && isNewRoom)
: this.clients.length > 0;
}
Then went to http://localhost:2567/04-create-or-join-room.html
and pressed Create
once, then Join
once.
This is what I got in the server console:
Listening on http://localhost:2567
JOINING ROOM
roomId: BJl3OCrCWX, create: true, isNewRoom: true
CREATING NEW ROOM
roomId: BJl3OCrCWX, create: undefined, isNewRoom: false --
roomId: BJl3OCrCWX, create: undefined, isNewRoom: false -- why is requestJoin called twice?
CREATING NEW ROOM