The Replication protocol is based on the AppWebsocket protocol and is used between a publisher and a replicator to replicate a table of data between these two entities. When the replication starts, the complete table is replicated from the publisher to the replicator. During the replication session is active any changes are replicated in both directions.
{
"api": Name of the Table,
"mt": Name of the Message,
"src": AppWebsocket src
}
The AppWebsocket message format is used with the api, mt and src properties. To identify which AppWebsocket connection can be used for Replication and is not scope of the specification, but is defined for the specific publisher.
Messages sent by the Replicator{
"api": TableName,
"mt": "ReplicateStart",
"guid": hexstring,
"usn": ulong64,
"add": bool,
"del": bool,
"columns": Columns
}
This message is used by the Replicator to start or restart an replication. The replicator indicates it it ís able to add or delete rows and provides a list of columns it is interessted in.
{
"api": TableName,
"mt": "ReplicateNext"
}
{
"api": TableName,
"mt": "ReplicateAdd",
"columns": Columns
}
{
"api": TableName,
"mt": "ReplicateDel",
"columns": Columns
}
{
"api": TableName,
"mt": "ReplicateAdd",
"columns": Columns
}
{
"api": TableName,
"mt": "ReplicateStartResult",
"guid": hexstring,
"usn": ulong64,
"columns": Columns
}
This message is sent by the publisher in response to a ReplicateStart message. The columns avaliable on the publisher are indicated in this message
{
"api": TableName,
"mt": "ReplicateNextResult",
"usn": ulong64,
"columns": Columns
}
{
"<row0>": { <"update":true> },
"<row1>": { <"update":true> },
...
}
The columns object is used to describe the columns of a replication session. For each column a property with the name of the column is used. This property is an object, with the optional boolean property "update", which indicates, if update of the column is possibe/desired.