1

Online versus Offline

From Resco's Wiki
(Redirected from Overriddencreatedon)
Jump to navigation Jump to search

Resco mobile apps can work in either online or offline mode. The online mode is usually something that most users understand intuitively. It offers a similar experience to working with a web browser. However, the offline mode can be conceptually harder to understand and some users aren't quite sure what to expect.

Online mode

Let's start with the online mode. Imagine this model situation: You start your Resco mobile app, open the list of accounts, scroll the list to locate the account of interest, do some editing, and save the account changes. What happens in the background? What kind of client-server communication is happening?

  1. A connection is established.
    This is actually a conversation, where the client introduces the user and asks the server to create a connection to a particular organization. The created connection is used for subsequent communication and automatically closes after a period of inactivity. (In which case the connection have to be re-established again later – can happen during the steps 2-4.)
  2. Next, the client asks for one page of “brief” accounts.
    A page means approx. 20 items. As you scroll down the list of accounts, additional pages are requested. “Brief” means that only selected account properties are requested – those that are shown in the list.
  3. When you select a particular account from the list, another server request is made. This time the server has to deliver the complete information for the selected account.
  4. Finally, when the editing is over and you tap the save button, Resco app sends the changes to the server and waits for the server to respond with either ok or an error message.

Offline mode

How do things change in offline mode? The offline client downloads a subset of the server data to a local database on the device. As part of this process, all accounts to which you have read permissions are stored on the device. Now you can start working with the downloaded data.

  1. The account table in the database is opened and one page of (brief) accounts is read. Again, as you scroll down the list, additional pages are read.
  2. When you open the account, full account data is loaded from the database.
  3. Once you're done editing, the changes are saved to the database. Additionally, the account record is marked as “dirty” (this information is stored in the change log) so that the change can be later sent to the server.

Every now and then, you have to synchronize the local device with the server. As part of this process, all changes that you have made (stored in the change log) are uploaded to the server and potential new data is downloaded from the server and stored locally.

Comparison

The big difference between both modes is immediately clear – the data storage:

  • The offline mode keeps the data in the local database; hence the data loading/storing is fast and presents no problem at all. What is difficult – is the (occasional) synchronization between the local and remote databases.
  • The online mode uses a remote database (located at the server), hence all data operations are slow, costly, and potentially risky (depending on the quality of your internet connection).

These are some of the disadvantages of the online mode:

  • Increased internet traffic (the same data is sent again and again)
  • Slower UI responsiveness
  • Occasional connection problems
  • Shorter battery life

One of the advantages of the online mode is that it does not need data synchronization. However, even in online mode, synchronization is necessary in the case of updated app projects, to download new customization.

While most readers intuitively understand the above differences, some may not realize how inefficient the client-server communication is. Here is a small illustration: When the server sends the information about when a particular record was created, it actually sends an XML string similar to this:

<b:KeyValuePairOfstringanyType>
  <c:key>createdon</c:key>
  <c:value i:type=”d:dateTime” xmlns:d=”http://www.w3.org/2001/XMLSchema”>2014-05-19T15:35:37Z</c:value&gt;
</b:KeyValuePairOfstringanyType>

Compare it to a string carrying identical information:

createdon=2014-05-19T15:35:37Z

In other words, the protocol used for client-server communication is extremely bloated. Typically, 90% of the data sent is an overhead. Fortunately, this bloated protocol is wonderfully compressible; hence it does not impact the network traffic that much. However, the device battery will feel increased data processing.

As a rule of thumb, users in online mode experience similar response times to a web browser. Getting one server response (many screens need multiple requests) usually takes 0.1 - 0.5 seconds. Occasionally, due to various connection hiccups, it can last longer, and every now and then you will wait a lot longer only to receive broken connection error.

The offline client typically does not show any delays at all.

See also

To learn more about the advantages and disadvantages of online and offline modes, consider also the following resources:

  • Technical deep dive Blog
Part 1: Difference between online and offline mode
Part 2: How Resco implements the offline mode
Part 3: Synchronization

Record creation date

When you create a record in a Resco mobile app in offline mode, it is created locally on the device. The server version is created when you synchronize the app. By default, the time of the synchronization is used as creation time. However, you can change this behavior. This function is available for Dynamics backend.

  1. In Woodford, edit an app project.
  2. Select an entity from the Project menu, for example, Account.
  3. Enable the field Record Created On (overriddencreatedon).
  4. Save all changes and publish the project.

From this moment on, the app will attempt to update also the creation date. However, this requires special permission in your backend. Without this permission, you will run into synchronization errors.

  1. In Dynamics, go to Settings and select System > Security.
  2. Go to Security Roles and edit the security role of the app user.
  3. On the Business Management tab, scroll down to Miscellaneous Privileges and enable Override Created on or Created by for Records during Data Import.
  4. Save all changes.


Was this information helpful? How can we improve?