Module: DiffSyncClient

AeroGear. DiffSyncClient

new DiffSyncClient(config) → {object}

Status: Experimental
The AeroGear Differential Sync Client.
Parameters:
Name Type Description
config Object A configuration
Properties
Name Type Argument Default Description
serverUrl String the url of the Differential Sync Server
syncEngine Object <optional>
"AeroGear.DiffSyncEngine" -
onopen function <optional>
will be called when a connection to the sync server has been opened
onclose function <optional>
will be called when a connection to the sync server has been closed
onsync function <optional>
listens for "sync" events from the sync server
onerror function <optional>
will be called when there are errors from the sync server
Source:
Returns:
diffSyncClient - The created DiffSyncClient
Type
object

Methods

_diff(data) → {Object}

diff - an internal method to perform a diff with the Sync Server
Parameters:
Name Type Description
data Object the data to perform a diff on
Source:
Returns:
- An Object containing the edits from the Sync Engine
Type
Object

_patch(data)

patch - an internal method to sync the data with the Sync Engine
Parameters:
Name Type Description
data Object The data to be patched
Source:

_sendEdits(edit)

sendEdits - an internal method to send the edits from the Sync Engine to the Sync Server
Parameters:
Name Type Description
edit Object the edits to be sent to the server
Source:

addDocument(doc)

addDocument - Adds a document to the Sync Engine
Parameters:
Name Type Description
doc Object a document to add to the sync engine
Source:

connect()

Connects to the Differential Sync Server using WebSockets
Source:

disconnect()

Disconnects from the Differential Sync Server closing it's Websocket connection
Source:

fetch(docId)

fetch - fetch a document from the Sync Server. Will perform a sync on it
Parameters:
Name Type Description
docId String the id of a document to fetch from the Server
Source:

getDocument(id) → {Object}

getDocument - gets the document from the Sync Engine
Parameters:
Name Type Description
id String the id of the document to get
Source:
Returns:
- The document from the sync engine
Type
Object

removeDoc()

removeDoc TODO
Source:

sync(data)

sync - performs the Sync process
Parameters:
Name Type Description
data Object the Data to be sync'd with the server
Source:

<inner> send(msgType, doc)

send
Parameters:
Name Type Description
msgType String
doc Object
Source: