Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Limitations and Design Considerations

Limitations and Design Considerations

For the most part, your app will work seamlessly in offline mode. However, the lack of connectivity to its backend may cause some features to not work as in online mode. Knowing the limitation means that you can provide for them in your code to ensure the best possible experience for your users.

This article is organized as follows:

Unsupported Operations

The following operations and features are not supported offline because they always rely on online data:

  • Authentication-related operations (login, logout, etc.)
  • User Management operations, except for read (delete, update, create, change password, etc.)
  • Operations related to Push Notifications
  • GeoPoint queries

Data Operations During Synchronization

While synchronization is in progress, all data operations are prohibited and return an error. This is necessary to prevent data integrity issues.

You can check whether synchronization is currently in progress using the isSynchronizing() method:

if (el.offlineStorage.isSynchronizing()) {
    ...
}

The error that you get if you invoke a data operation during synchronization looks like this:

{
    code: 10003,
    message: 'Cannot perform operation while synchronization is in progress'
}

Performance

Offline support is not designed to work with large amounts of data on the client. If you have a lot of data on the server and want to store it offline on the device, this may overwhelm the device's storage and processing resources, especially in the mid- and low-end segments.

On huge data sets synchronization may take a long time, especially on slow network connections. Keep this in mind as new data operations are not processed during synchronization.

Therefore it is recommended that you work with limited data on the client, choosing only data that you need. This will speed up both your app and the synchronization process.

Users and Authorization

Offline support is designed to work along with the Telerik Platform User Management service.

When a user logs in, the user ID is automatically stored offline. It is used later, when creating or updating data offline to maintain valid values for the CreatedBy, ModifiedBy, and Owner fields.

However, most User Management operations such as delete, update, create, and change password are not supported. Only the read operation is supported.

Permissions

Permissions are not being processed in offline mode. Operations that would normally fail due to lack of permissions online, would succeed offline. However, the permissions will be applied when you synchronize offline data to the cloud.

Business Logic

You need to carefully evaluate your Business Logic if you want to utilize the JavaScript SDK's offline support.

If you use Cloud Code for Data, you may have logic that validates or alters data requests in some way. Because this code lives and runs in the cloud, it will not be applied on data requests when working offline. However, it will be applied when you synchronize the offline data to the cloud.

If you utilize Cloud Functions, your app will not be able to call them when offline. Ensure that your code handles these situations gracefully, with meaningful UI feedback.

Data Connectors

Offline support is compatible with data coming from an external data source linked using the Data Connectors feature, but with a couple of caveats, discussed below.

ID Generation

Content types stored in Telerik Platform use UUIDs for the Id field. This may not be the case for content types bound to an external data source. They may use a number or another type of identifier for Id.

When you create an item in offline mode, the SDK automatically generates a UUID and sets the Id field to it. This works great for content types stored in Telerik Platform, but might cause the operation to fail for external content types when synchronizing the data to the cloud.

To handle this, you have the option to switch off Id generation in the SDK. This way new offline items are created without an Id on the client. Later, when you synchronize them, the underlying database generates the Id, which is then returned to the client and automatically updated in the client item.

ID generation is disabled per content type. For example:

var el = new Everlive({
    appId: 'your-app-id',
    offline: {
        typeSettings: {
            "ContentTypeName": {
                "autoGenerateId": false
            }
        }
    }
});

ModifiedAt Field

In Telerik Platform, every content type has a system-created ModifiedAt field, which stores the date and time the item was last updated. This field is maintained automatically and is used in the synchronization process for offline support.

When using Data Connectors, you need to map an existing database field as ModifiedAt for everything to work as expected. If you fail to do that, you will only be allowed to use the ClientWins synchronization strategy.

Relation Expands

Results of relation expand requests cannot be used offline to make new data requests because they contain a modified object. To use relation expanding offline, you need to have each of the related content types stored on the device.

Web Apps and Web-based Simulators

Web apps as well as Web-based simulators (including the AppBuilder in-browser device simulator) only support the LocalStorage storage provider. If you need to use another storage provider such as when working with files, test on a physical device.

The AppBuilder desktop device simulators support the FileSystem storage provider.

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.