I pulled up two browsers (Firefox Dev Ed, STP). I see the new shouldBroadcast and clientCount log. When the second browser connects, I see clientCount 2. I’m not seeing any updates on the first browser. shouldBroadcast is false. Does that mean it’s not broadcasting?
UPDATE
It’s working now. I guess I didn’t refresh my first browser?
so before what used to happen (and what matches what you observed), is that on load the client would connect to the websocket but (to reduce server load) would only broadcast if the space had other clients connected.
What used to happen is that same-user-clientA would connect and not see anyone so wouldn’t broadcast. Then when B connected and would see A, A wouldn’t see B. In this state, events from A wouldn’t broadcast to B, until B sent it’s first broadcast message to A.
In this fix, there’s extra logic to handle same-user-clients (different from collaborator clients). And when A receives connects to the broadcast it now gets a list of all clients - the clientCount. The way clientCount works is that it’s a total of owner + collaborators + + spectator + clients in a space. The lowest the count can be is 2 (e.g. you as a member/spectator + your client/browser), so broadcasting only happens beyond 2.
clients are counted separately because a member/spectator can have 1 or many additional client windows (browsers) open.
It’s a bit complex to explain, hopefully that makes some sense