Technical Background

The Z-Push protocol is HTTP based, and uses WBXML (WAP Binary XML) as a communication layer, which is used for bi-directional communication between the PDA/cellular phone and the Server.

Inside the protocol there is everything you expect from a synchronisation protocol: the process of sending items from one side to the other, while keeping track of what has already been sent. The Z-Push hides the complexity of handling these protocol requests to the backend developer, who only needs to implement various standard functions, like getting a list of items, and getting the data for a specific item. All that is needed is a good understanding of the WBXML object definitions and fields, and a developer can quite easily get the items of any groupware solutions onto the PDA/cellular phone.

Architecture & Performance

The Z-Push has various perfomance and usability-related features; for example, the entire architecture of the project is based on the idea that only one message should ever have to be in memory at one time, even when the server is sending hundreds of messages to a PDA. This may sound easy, but in most XML-based applications, the XML result data is built in-memory before being serialized to the network – exactly the opposite to what Z-Push does, as data is streamed to the client while it is read from the backend. This not only improves already restricted memory usage in PHP, it also makes the progressbar on the client more user-friendly, as data starts arriving as soon as the synchronization request is made. Zarafa has provided a streaming WBXML encoder and decoder to make this happen.

When a backend supports it, Z-Push can also make use of advanced features which bring server load down even lower, for example reading message changes directly from a ‘diff’ source, instead of comparing all the messages with whatever was in there last time. So if the groupware backend can provide a list of changes on-the-fly, then Z-Push can use this information almost instantaneously. Zarafa provides an incremental synchronisation backend for its own MAPI-based solution here through their PHP-MAPI extension, enabling extremely low-load synchronisations.

Developing own backends

To aid in the development of additional backends, the Z-Push package already provides some simple examples of how to implement a so-called ‘diff’ based engine. All the differential logic is implemented in a ready-made backend called the diffbackend. This allows developers that are querying an existing backend which has no existing incremental capabilities to be written very quickly and very easily; in fact, the provided ‘vcarddir’ backend which can read directories of ‘vcard’ files, implements a full ‘contacts’ synchronisation backend in only a few hundred lines of PHP code.

Developers wanting to add new backends can use the existing ‘maildir’ and ‘vcarddir’ backends as a basis to write their own. They can be written to retrieve data from any data source, including MySQL databases, which is the most common storage engine for most groupware applications. All that the developer needs to add are up to 10 functions that list and retrieve messages and folders, and optionally move folders or send email. Any PHP developer of a groupware solution should be able to write a backend in under a few hours.

Get in touch

Don’t hesitate to contact us at the forum. We hope that in the future more backends will be available for Z-Push and we will reach more interested people.

Pushing emails to mobile phones in real-time is one of the most interesting technologies at the moment. Be a part of it!