Possible bug regarding awareness

I’m using y.js for a collaborative editing app and I’d like to see the number of online users(I use y-websocket). Currently I’m checking webSocketProvider.awareness.getStates().size but I get a strange glitch: the first time the user opens the app the value is shown correctly but if he refreshes the page the value changes to 1, although there are other users online too(and the awareness cursors work well). Sorry for posting this here but I don’t know if this is expected behaviour or no.

Update: it seems like the awareness is also tracked on a browser-basis, meaning that if I have the editor opened in browser x and I open it on browser y too, webSocketProvider.awareness.getStates().size will be 1 (the original problem was that if I have one tab open in a browser and I open another, the size will be 2, however if I refresh either page the size becomes 1).

If you can see cursors from other users, then the awareness state size can’t be 1. Can you please check again?

Make sure to check in regular intervals, not just once.

Hi, rechecked and the issue still persists, the size is 1 even if multiple clients are connected. The thing is, I need the number of users right after the websocket connection is enabled so I’m asking if I maybe have to wait a few seconds to get the real number(as the cursors work instantly I didn’t think it should be a problem).

Another update: it all seems to be related to the websocket server. Refreshing the page too often glitches it and produces unexpected behavior, like late synchronization of text (hard to explain what I mean by this cause it’s strongly related to my app but you got the point) in some cases.