syncml-js package is in "beta". That means that everything is
fully functional, however it has not had much real-world experience,
and therefore there are definitely bugs hidden here and there. Use
with caution, and always backup your data before doing anything (see
sbt for a convenient backup tool that
uses this SyncML implementation).
This is the easy part, provided you have
npm install syncml-js
syncml-js does not provide any command-line tools, so
you typically would list it in your package.json's "dependencies"
attribute and use it in your application.
For in-depth discussion on how to use a SyncML protocol library, please take a look at pysyncml: despite being in python, it uses the same concepts and almost an identical API. Basically, creating a SyncML client comprises the following steps:
Create the actual data layer of where your data lives, how it is stored and formatted, and the mechanisms that users use to interact and manipulate it.
Create an "Agent" class, which implements an API that forms the bridge between your data layer and the SyncML adapter.
Instantiate a "Context" and an "Adapter", classes provided by this package, which are responsible for actually communicating with a SyncML peer.
Ensure that changes made to the data layer are registered to the SyncML library.
Synchronize the adapter, using the
adapter.sync() method for
client-side initialization or
server-side request handling.
Here is a quick example of such a client, which assumes that the first
step, the local data layer, is implemented elsewhere. It uses the
amdefine package to handle dependencies,
underscore for general
cascade for taking some of the pain out of
if typeofdefine !== 'function'var define = module;;