The connection type affects the way in which you can synchronize data between the mobile device and back-end systems. Synchronization is possible in two ways: continuously or through a store-and-forward method (see Figure 3-16). In the following sections, we will discuss these methods in more detail.
Figure 3-16 Synchronization methods
3.5.1 Continuous Communication
When the connectivity between the client and server is continuous, the synchronization of data between client and server is continuous and can be achieved through synchronous or asynchronous means (see Figure 3-17).
Figure 3-17 Synchronous and asynchronous communication
Synchronous communication occurs when a request to store data is sent to the server followed by the data to be stored. The data is then placed in a storage area, such as a database, on the server. In synchronous communication, all data is completely stored before the server acknowledges receipt of the data and frees up the client user interface.
Asynchronous communication occurs when a request to store data is sent to the server followed by the data to be stored. The data is then placed in a storage area, such as a database, on the server. In asynchronous communication, however, the data does not have to be completely stored before the server acknowledges the client. Indeed, the server typically acknowledges the request immediately and only subsequently carries out the store request. Subsequently, when the store request is actually complete, the server will initiate a conversation to tell the client it is done.
3.5.2 Store-and-Forward Synchronization
When connectivity between a client and server cannot be guaranteed, it is still possible to store and transmit information safely using a method called "store-and-forward."
Suppose, for example, that a mobile user wishes to enter data while his/her mobile device is not connected to a server. A mobile client application can initially store the data in a local database. Later, when a connection has been established, the mobile application will forward the data from the local database to the database on the server (see Figure 3-18).
Figure 3-18 Store and forward
Store-and-forward is a powerful method that allows mobile users the ability to work even when they are not connected to a server. It is important to note, however, that if you permit mobile users to store data in a local database in this manner, you must also ensure data integrity when the data is synchronized with the server database, since other users may be adding or modifying possibly conflicting data on their mobile devices.