Within a JSONStore one will find a set of "Documents". This might be a confusing name as they
should not be considered documents such as PDF, Word or Excel. Rather, in Worklight parlance,
a document is record or data structure. Each document consists of two primary parts:
• An ID field that is unique to the document
• A JavaScript object that is the content of the document
A second level of abstraction called a "Collection" is defined. A collection is a container of
documents. If one thinks of a document as a database row then a collection can be considered as
database table containing those rows.
One final abstraction exists which is that of the JSONStore "store". The store is a set of collections.
Following our database analogy, the store itself can be thought of as a database instance hosting all
the different collections which in turn host each of the documents.
Push Notification
It is not uncommon for a mobile application to request that a back-end system perform some work
on its behalf. What we now wish to look at is the converse of this … namely a back-end system
wishing to push information asynchronously to the mobile app. Examples of this would be
informing the application that a stock has reached a sell threshold or a new transaction has occurred
on a user's credit card.
IBM Worklight provides technology for handling such push notifications. Currently, the push
technology works with Android, iOS, and Windows Phone 8. The way the push actually happens is
a function of the device platform. For android it is Google Cloud Messaging (GCM), for iOS it is
Apple Push Notification Service (APNS) and for Windows Phone 8 it is the Microsoft Push
Notification Service (MPNS).
Testing
When building a solution, it is essential that it be tested often. Worklight provides a component
called the "Mobile browser simulator". What this is is a web application which runs the web
portions of your application in a browser. The browser shows the form factor of a variety of
named devices allowing you to see what your app will look like on a variety of different systems.
Page 62
Comentarios a estos manuales