Welcome to Mesh4X !!!
InSTEDD is an innovation lab for technologies designed to improve community resilience and save lives through early disease detection and rapid disaster response.
Currently Mesh4x has Java and .Net versions and the Python implementation is coming soon (see waj blog).
- Eduardo Jezierski, alias Ed (InSTEDD), writes about the real usage of these technologies in Build maps collaboratively with new Mesh4x KML adapter, Where 2.0 , Improvements to Mesh4x KML adapter ("Mesh4Maps"?) , Mesh4x SMS Adapter: Sync data without an Internet connection.
- Daniel Cazzulino, alias kzu (MVP, Clarius), writes about feed sync FeedSync under the hood and mesh project Mesh 4 X.
- Pablo Cibraro, alias cibrax (MVP Clarius), shares his ideas and expertise about feed sync in Overview of FeedSync support in the Microsoft Sync Framework.
Currently, sms usage is crucial for humanitarian tasks in the field (see Ed links). Due to this concern, we are working in a mesh4x adapter for sms that allows two-way synchronization of arbitrary data over basic cell phone SMS. Following this direction, in collaboration with JavaRosa, an OpenRosa java implementation which supports XForms for J2ME, we have migrated Mesh4J to J2ME and an experimental version is available here: Mesh4j2me Demo.
The main idea is to provide multi-node XForms editing and sharing on mobile phones (a.k.a. mesh ;)). Imagine the following scenario:
- The server is receiving data from multiple mobile clients.
- The user enters data on his phone (using JavaRosa XForms).
- Upon synchronization, the mobile client updates its local data by merging the the latest changes from the server via an HTTP data connection, and the new local data is pushed to the server the same way.
The server is a FeedSync-standard compliant server we've created with ASP.NET & WCF exposing a RESTFull API (see http://sync.instedd.org/Service.svc/feeds)
Cool! You could share your information with other people in the world. Your data is stored in a centralized server (but which can also be just a node in another mesh!), so you can also view your data from a PC if you want.
Important: You don't need to develop special code for sync, just use the provided Mesh4J2me library.
But, what happens when you do not have an Internet connection but still need to synchronize information in a peer-to-peer fashion? Isn't that the whole point of "mesh"?
Now, we can imagine the following scenario:
- Mobile1 - User enters data
- Send data from Mobile1 to Mobile2 using sms (with a different adapter this time)
- Mobile2 – The data is merged locally executing the sync algorithm
- The magic is done! Mobile2 - User has the information available locally in his device.
Cool,... sounds great, but...., Sms is not a reliable channel, messages can be lost and arrive not necessarily in the same sequence they have been sent. FeedSync is an XML-based format and it can be very long. How does Mesh4X manage those issues?
The adapter we mentioned above, called the SmsAdapter, defines an asynchronous protocol that provides a reliable connection; the main goal is to ensure that all the messages will arrive, each data is expressed as XML, it is compressed and split in a batch of messages with sequence ordering, and only when all the messages have arrived the XML is regenerated and the next protocol step is executed. Retries are used for re sending lost messages.
The protocol is based on Rsync ideas to send only the differences in data between the mobile phones.
The protocol is a state machine divided in 3 phases:
Phase 1: Differences negotiation
Phase 2: Data merging
Phase 3: Apply changes to the model
Feel free to take a look at our ideas in:
J2SE Spikes: https://mesh4x.googlecode.com/svn/Mesh4j/spikes/
In future posts I will explore deeper the Mesh4X project in its both synchronous and asynchronous modes.
What do you think about it?
JMT (Juan Marcelo Tondato)