Mobile applications with Ocsigen
Since Eliom 6.0, the Ocsigen framework provides infrastructure for building mobile applications. This enables rapid development of Android, iOS, and Windows Mobile apps with the same APIs and programming style as for a regular client-server Web application. In fact, one single codebase can be used to produce all these applications simultaneously.
The easiest way to get started with Ocsigen-based mobile development is to use Ocsigen-start. Ocsigen-start is a library and skeleton for building "minimum viable product" Web applications with standard functionality like users, notifications, etc. This skeleton is immediately usable as a mobile application. You can install ocsigen-start via OPAM ( opam install ocsigen-start ) and instantiate its template with the command eliom-distillery -name ocsimobile -template os.pgocaml. For launching the mobile application, follow the instructions in the template's README.md.
Programming style
You need to follow a certain programming style for your Eliom code to work flawlessly inside an Ocsigen-start mobile app. This style is described in the chapter on client services from the Eliom manual. The idea is that you implement as much of your application as possible in shared sections ([%%shared ...] or let%shared ... = ...), and that you register handlers for your Eliom services on both the client and the server. The Ocsigen-start template already uses the above programming style, so refer to the files generated by eliom-distillery for inspiration.
Going further
- Ocsigen-toolkit provides a set of user interface widgets that are particularly useful for mobile applications.
- Danny Willems provides a comprehensive set of OCaml bindings to Cordova plugins. These can readily be used for your Eliom mobile application.