Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated state not being replicated to new joiners to a scene #443

Open
diarmidmackenzie opened this issue Dec 10, 2023 · 2 comments
Open

Comments

@diarmidmackenzie
Copy link

diarmidmackenzie commented Dec 10, 2023

I'm adding NAF support to an interactive A-Frame festive scene.

One problem I have noticed is that while entities are correctly synced between clients, when a new client joins the scene, entities that have been moved from their original positions don't get their positions updated until they are moved again.

I don't yet understand why this doesn't work.

On connection of a new client, NAF has code that will trigger a call to NAF.entities.completeSync() see code here

I've checked, and the new client connection is being detected, this code is being executed, and yet the entity positions aren't getting updated on the new client.

I have implemented a workaround, which is simply to make another call to completeSync() (this time with isFirstSync set to false) on detection of the clientConnected event.

This workaround is working fine for me, so I don't have a problem any more. But it seems like the existing NAF mechanism should have been adequate, and for some reason it wasn't.

I can re-construct the issue if someone wants to look into this. I don't think I'll be able to prioritize looking into this further in the short term, as I have a viable workaround in place.

@vincentfretin
Copy link
Member

I know there are issues if you test using two Chrome tabs, like the received messages are not processed until you are on the tab, so you may have time dependent issues, but that's probably not your issue here. Using two windows work fine.

I guess you're using wseasyrtc adapter, right? So data are sent with WebSocket.
I explained how the sync works in #409 (comment) if you didn't read it yet.
First thing would be to look at the WebSocket messages sent from the Chrome Network tab (select the websocket and go to Messages tab). The current owner of the entities will send the data to the new joined user. Does the data have the correct position there? If yes, then does the receiving end see the same message?

I want to mention also a different issue we had with janus adapter (with unreliableTransport set to datachannel, so through WebRTC, the default, because we can also send data through websocket, that's configurable), sometime the avatar of the joined user didn't show up for the other users. My guess was the data may be sent too early before the DTLS handshake of the RTCPeerConnection, but I never confirmed that. We added a workaround to send an avatar firstSync every 5s with a periodic-full-syncs component, see #243 (comment) I still have the component in two of my projects, not sure if it's still needed. I don't think we had this issue with easyrtc adapter.

@diarmidmackenzie
Copy link
Author

diarmidmackenzie commented Dec 11, 2023

I was using wseasyrtc when I first hit the problem, and implemented & tested my workaround.

I have since moved to easyrtc, to enable audio between participants, and haven't noticed any differences (but didn't try backing out my workaround).

I am now seing some odd issues with ownership changes not being replicated between clients when testing with side-by-side Chrom instances on desktop (2 windows, both visible). I doubt that is related to this, but I haven't understood it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants