How do I get Join Leave JoinedRoom LeftRoom events?

I am listening for and receiving UserJoinedRoom and UserLeftRoom events but I can’t seem to get the Join/Leave or JoinedRoom/LeftRoom events.

Below is the code I am using:

private userJoined(_: UserJoinedOrLeftRoomModel)  {
        console.log("User joined: " + _.userId);

    private userLeft(_: UserJoinedOrLeftRoomModel)  {
        console.log("User left: " + _.userId);

    private joinedRoom(_: JoinedRoomResponse): void {
        console.log("Entered Room: " +;

    private leftRoom(_: LeftRoomResponse): void {
        console.log("Left room: " +;

    awake(): void {

        const conn: NetworkConnection = this.context.connection;

        this.context.connection.beginListen(RoomEvents.JoinedRoom, this.joinedRoom.bind(this));
        this.context.connection.beginListen(RoomEvents.LeftRoom, this.leftRoom.bind(this));
        this.context.connection.beginListen(RoomEvents.Join, this.joinedRoom.bind(this));
        this.context.connection.beginListen(RoomEvents.Leave, this.leftRoom.bind(this));
        this.context.connection.beginListen(RoomEvents.UserJoinedRoom, this.userJoined.bind(this));
        this.context.connection.beginListen(RoomEvents.UserLeftRoom, this.userLeft.bind(this));        

Original Post on Discord

by user 563549194137239552

Join and Leave events are events that are sent to the server.
Joined and Left Room events are used for own connection to a room.

I’m not getting either of them but i am getting the user enter/leave events… I would like to get all of them

by user 563549194137239552

If I remove the argument from my function I get the Joined Room event… I want to get access to the event data in JoinedRoomResponse

by user 563549194137239552

after the event is fired the data is available via this.context.connection

ok… I will look in the connection directly instead of trying to use the JoinjedRoomResponse

by user 563549194137239552

should i do the same with the userJoined and userLEft events… ignore the UwserJoinedOrLeftRoomModel ?

by user 563549194137239552

No that’s available via the event. Sorry for the inconsistency there.

You could also query this.context.connection.usersInRoom() method of course too

basically what i want to do is determine if the instance joining a ro9om is the first person in the room… and then monitor who is coming and going and restrict some things to the person who first create the room

by user 563549194137239552

that might be better handled by learning how the ownership stuff works

by user 563549194137239552

Yes I think so. Maybe using the OwnershipModel helps there (it’s exported from engine_networking.ts) - that’s what Avatars or SyncedTransform components use

I am getting this as the room name : GlitchTemplatewild_dog_434 - not sure if the GlitchTemplate at the beginning is a bug or not… this is coming from this.context.connection.currentRoomName

by user 563549194137239552

No that’s intentional - it’s so that multiple different deployed scenes/projects can share one backend without having to worry that they accidentally share state

you can set the prefix here