When I get data from Room.onStateChange I don't receive my players

31 Mar 2020, 20:56

I have a players Map Schema on my State, I receive my changes on my client, but the array players [] its empty. Is this a normal behavior?

1 Apr 2020, 00:18

I had the idea that onStateChange method includes the current state of the application, but the players MapState comes as an object without relevant data about Players. I changed that call to room.state.onChange = () => {} and it seems to be a better way to update my client-side state

9 May 2020, 20:09

hey bro, did you resolve this issue?

24 May 2020, 04:32

The same thing occurred when today I created a new server. I am not able to get the contents of a map.

24 May 2020, 04:39

@virtumonde Try updating your node packages and change the client side codebase as of changes in new version changelog, as there was update in colyseus new version same thing happened to me.

24 May 2020, 04:42

@nag0121 Let me try.

24 May 2020, 05:04

It didn't solve my problem. At least in my case it is not a client version mismatch.

24 May 2020, 06:06

I am an idiot. I forgot that at the begging of the client connection you can't access the state via room.state, it is blank. I do receive that changed version of the state however.

24 May 2020, 06:19

Now it's broken again. Will check tomorrow.

1 Jun 2020, 21:28

For whoever may read this: check the state with room.onStateChange, not right away you are connecting to the room.