You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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, see
// If we receive a firstSync for a persistent entity that we don't have yet,
// we assume the scene will create it at some point, so stash the update for later use.
this._persistentFirstSyncs[networkId]=entityData;
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 mozilla/hubs@f2d779d
Today, Hubs doesn't use this API anymore, they maintain their own list of persistent entities received through Phoenix socket, and use their own api applyPersistentSynchttps://github.com/mozilla/hubs/search?q=applyPersistentSync
There is also an option NAF.options.firstSyncSource that is not documented
NAF.log.write('Ignoring first sync from disallowed source',source);
}else{
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 and applyPersistentFirstSync api explained above become useless.
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 mozilla/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 MozillaReality#33
see the related PR on Hubs too mozilla/hubs#1556
The text was updated successfully, but these errors were encountered: