Miscellaneous features

The code of this tutorial has been tested with Eliom 4.

Multi-user collaborative drawing application

We now want to take back our collaborative drawing application and turn it to a multi user one. Each user will have his own drawing, where everyone can draw, and the owner will have the ability to save the drawing he wants and create an Atom feed containing all saved drawings.

See the full code of examples.

Split application into multiple files and using several canvas

In this first section, we will build a multi-canvas drawing application. Each drawing has its own URL. Everyone can create a new drawing by going to the corresponding URL.

We need to refactor some parts. In particular, we need to be able to handle separately different drawings. To do this, we will turn all global variable, like the bus, in local ones.

When an application grows, it start being useful to split it in multiple files. For sake of example, we will split graffiti into 4 files.

  • common.ml which will be part of both client and server, containing shared types and declarations
  • client.ml client only part of the application
  • server.ml server only part of the application
  • graffiti.eliom the only part where we need to include both client and server code


It contains what was in {shared{ ... }}

type messages = ((int * int * int) * int *