Related Classes
Methods
- path optional
- Type:
string
The path to the Realm to reset. Throws error if reset is not possible.
- the
- Type:
string
user agent description
Returns true
if Realm still has a reference to any sync sessions regardless of their state.
If false
is returned it means that no sessions currently exist.
Enable multiplexing multiple sync sessions over a single connection. When having a lot of synchronized realms open the system might run out of file descriptors because of all the open sockets to the server. Session multiplexing is designed to alleviate that, but it might not work with a server configured with fail-over. Only use if you're seeing errors about reaching the file descriptor limit and you know you are using many sync sessions.
Initiate a client reset. The Realm must be closed prior to the reset.
Parameters:
Example:
{
const config = { sync: { user, partitionValue } };
config.sync.error = (sender, error) => {
if (error.name === 'ClientReset') {
Realm.Sync.initiateClientReset(original_path);
// copy required objects from Realm at error.config.path
}
}
}
Calling this method will force Realm to attempt to reconnect to the server immediately.
Realm will reconnect automatically, but by using exponential backoff. This means that if the device is offline for a long time, restoring the connection after it comes back online can take longer than expected. In situations where it is possible to detect the network condition (e.g. Airplane mode). Manually calling this method can provide a smoother user experience.
Set the application part of the User-Agent string that will be sent to the Realm Object Server when a session is created.
This method can only be called up to the point where the first Realm is opened. After that, the User-Agent can no longer be changed.
Parameters:
Type Definitions
- level
- Type:
number
The level of the log entry between 0 and 8 inclusively. Use this as an index into
['all', 'trace', 'debug', 'detail', 'info', 'warn', 'error', 'fatal', 'off']
to get the name of the level.- message
- Type:
string
The message of the log entry.
- type
- Type:
string
how to open a Realm - 'downloadBeforeOpen' to wait for download to complete or 'openImmediately' to open the local Realm
- timeOut optional
- Type:
number
how long to wait for a download (in ms). Default: infinity
- timeOutBehavior optional
- Type:
string
what to do when download times out - 'openLocalRealm' to open the local Realm or 'throwException' to throw an exception.
- user
- Type:
Realm.User
A
Realm.User
object obtained by callingRealm.App.logIn
.- partitionValue
- Type:
string
ornumber
orBSON.ObjectId
The value of the partition key.
- error optional
- Type:
function
A callback function which is called in error situations. The
error
callback can take up to five optional arguments:name
,message
,isFatal
,category
, andcode
.- customHttpHeaders optional
- Type:
Object
A map (string, string) of custom HTTP headers.
- newRealmFileBehavior optional
- Type:
OpenRealmBehaviorConfiguration
Whether to create a new file and sync in background or wait for the file to be synced. If not set, the Realm will be downloaded before opened.
- existingRealmFileBehavior optional
- Type:
OpenRealmBehaviorConfiguration
Whether to open existing file and sync in background or wait for the sync of the file to complete and then open. If not set, the Realm will be downloaded before opened.
The default behavior settings if you want to wait for downloading a synchronized Realm to complete before opening it.
A callback passed to Realm.Sync.setLogger
when instrumenting the Realm Sync client with a custom logger.
Parameters:
Type:
"all"
or "trace"
or "debug"
or "detail"
or "info"
or "warn"
or "error"
or "fatal"
or "off"
The default behavior settings if you want to open a synchronized Realm immediately and start working on it. If this is the first time you open the Realm, it will be empty while the server data is being downloaded in the background.
Specify how to open a synced Realm.
Type:
Object
Properties:
This describes the different options used to create a Realm
instance with Realm Cloud synchronization.
Type:
Object