altspace/utilities/sync

The Sync utility is currently based on Firebase. It provides a quick way to synchronize apps between users (even when they are running outside of AltspaceVR). During the SDK beta, please consider all data stored with the sync utility to be ephemeral (it may be cleared or clobbered at any time). You do not need a Firebase account to use the Sync utility.

Refer to the Firebase API documentation when working with the sync instance.

Classes

Connection

Methods

(static) connect(config) → {Promise}

Connect to a sync session to obtain Firebase references that can be used for syncronization of real-time and persistent state. Returns a promise that will fulfill with a Connection.

Note: Calling this method will cause a reload of the app, since it adds an 'altspace-sync-instance' query parameter to the app's url. Best practice is to establish a sync connection first, before you load any resources or render anything in your app. The promise returned by this method will be rejected the first time it is called, while the app reloads with the new sync instance id.

Parameters:
Name Type Description
config Object
Properties
Name Type Attributes Description
authorId String

A unique identifier for yourself or your organization

appId String

The name of your app

baseRefUrl String <optional>

Override the base reference. Set this to use your own Firebase.

instanceId String <optional>

Override the instanceId. Can also be overriden using a query parameter.

spaceId String <optional>

Override the spaceId. Can also be overriden using a query parameter.

userId String <optional>

Override the userId. Can also be overriden using a query parameter.