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.

Methods

(static) getInstance(params) → {Firebase}

Returns a firebase instance, just as if you had called new Firebase()

By using syncInstance.parent() you can store cross-instance data like high scores. Likewise you can store persistent user data at syncInstance.parent().child([userId).

Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
appId String

An identifier for your app.

instanceId String <optional>

An id for a particular instance of your app. Leave this blank if you would like to have one automatically generated and appended as a query string.

authorId String <optional>

An identifier for the author of the app.

Example
var syncInstance = altspace.utilities.sync.getInstance({
    // All sync instances with the same instance id will share 
    // properties. 
    instanceId: yourInstanceId, 
    // This helps to prevent collisions.
    authorId: yourAuthorId  
});