How to get currect player list? playerExits event didn't emit using Websocket API

I was trying to get the player list with this command


However, I keep getting the same list even if I already closed Gather town.

Then, I tried to subscribe to a playerExist event to see if it works when I close the tab. I still don’t get and event when I close Gather town.

Please help me to get the current usage of the Websocket API.

Would you be able to share more of your code (more context around where you are calling this console.log and your subscription to the playerExits event)? I’m not aware of any issues with the players object not being updated.

Just as a second hand up, I also noticed this issue.

I might be able to pin down when it happened if I look back at my logs, but not until tomorrow.

I noticed a tracking program I run on one of our spaces was reading a very high population in the middle of the night, despite me only seeing a fraction of that amount on the /app side of things.

I was tracking both player count and # of uuids in the space.

Hopefully this describes more of what had happened.

@eli @Bill_Uncork-It I found the problem. I didn’t notice that when connecting with the Websocket API, it insert your player account into the space and it never leave until your process is disconnected.

I was opening the browser and logging with my account at the same time. So, it’s hard to tell the different at that time. If you use another account for connecting to Websocket API, then you will see it works as expected.

But I was wondering if the API player can be hidden to the space. It would be a little strange to insert a API player into the space.

@jcyh Hm. Good catch, but that isn’t the same issue I am having. On the idea of hiding the API character, you could always add an exception for that characters UUID, which is the same across all spaces.

@Bill_Uncork-It What do you mean by exception the UUID? What I mean by hiding the charactor is, it will not show up in the space room.

I can filtered out the UUID when I use getPlayers function and manully filtered the UUID. But this will not hide the charator.

Ah, sorry, I thought you meant to hide them from data collection.

Not a great answer, but you could simply teleport the character to somewhere inaccessible by the users.

1 Like