-
Notifications
You must be signed in to change notification settings - Fork 295
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
Add more doc about persistent entities #265
Labels
Comments
This was referenced Mar 26, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See #238 to add an example that use a persistent entity with
persistent:true
.With
persistent:true
, each participant is responsible of creating the entity, it is only synced. Generally you have an entity in the html like the example in #238 or you create the entities dynamically before you enter the room, this is what Hubs does.If you're using
connectOnLoad:true
or in other circumstances, you may receive an update for a persistent entity that is not created yet, the data is saved for later, seenetworked-aframe/src/NetworkEntities.js
Lines 78 to 81 in 393ec7b
In an old version of Hubs, they used that with the
applyPersistentFirstSync
api to update the newly created entity with the data previously received. I searched in the history, here is an example Hubs-Foundation/hubs@f2d779dToday, Hubs doesn't use this API anymore, they maintain their own list of persistent entities received through Phoenix socket, and use their own api
applyPersistentSync
https://github.com/mozilla/hubs/search?q=applyPersistentSyncThere is also an option
NAF.options.firstSyncSource
that is not documentednetworked-aframe/src/NetworkEntities.js
Lines 75 to 77 in 393ec7b
to ignore firstSync persistent data coming from a source that we don't allow (naf adapter), this is used by hubs to only take care of the firstSync persistent data via the Phoenix socket so they can check permission on the backend side that the user can spawn entities and pin them.
https://github.com/mozilla/hubs/blob/614818eb2a1c3b23b49700a2023709a86532e283/src/hub.js#L225
If
NAF.options.firstSyncSource !== null
, the_persistentFirstSyncs
andapplyPersistentFirstSync
api explained above become useless.The persistent attribute was added to the table https://github.com/networked-aframe/networked-aframe#example-attachtemplatetolocalfalse in the documentation (that's the only doc!) by Hayden in commit 64a852f just after he merged the changes from Mozilla's fork that contains this PR Hubs-Foundation#33
see the related PR on Hubs too Hubs-Foundation/hubs#1556
The text was updated successfully, but these errors were encountered: