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

Add a spawned persistent spheres (server side) example #328

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vincentfretin
Copy link
Member

@vincentfretin vincentfretin commented Mar 26, 2022

#327 was using a peer to peer persistence.
In this example, we save the persistent entities server side. This addresses #139

  • keep in memory server side the persistent entities (using the NAF u persistent firstSync messages may not be the right way though, this requires to have unreliable transport on the websocket, so currently with wseasyrtc, see Make the easyrtc adapter unreliable transport configurable #324 to use websocket for easyrtc adapter)
  • broadcast persistentEntityCreated message to all participants from the server when a participant create a persistent entity
  • send persistentEntities message from the server that includes all persistent entities of the room when a participant join the room
  • persistent-server component that do the necessary things with the persistentEntityCreated and persistentEntities messages coming from the server
  • use NAF option firstSyncSource to allow firstSync entities from the server only, see Add more doc about persistent entities #265
  • persist entities in a file on the filesystem (persisting in postgres via superbase out of scope for this repo)

@vincentfretin
Copy link
Member Author

To save on the server persistent entities, saving all components updates is probably wrong in some cases.
If you spawn for example a video, you want to save the position, rotation, scale and url of the video, but not the video.currentTime on the server. But you still want the video current time to be synced between participants.
So you want to save only if isFirstSync is true.

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

Successfully merging this pull request may close these issues.

1 participant