Replication

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.

General message structure

{
    "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 Messages sent by the Publisher
Objects - recurring definitions

ReplicateStart

{
    "api": TableName,
    "mt": "ReplicateStart",
    "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.

ReplicateNext

{
    "api": TableName,
    "mt": "ReplicateNext"
}

ReplicateAdd

{
    "api": TableName,
    "mt": "ReplicateAdd",
    "columns": Columns
}

ReplicateDel

{
    "api": TableName,
    "mt": "ReplicateDel",
    "columns": Columns
}

ReplicateUpdate

{
    "api": TableName,
    "mt": "ReplicateAdd",
    "columns": Columns
}

ReplicateStartResult

{
    "api": TableName,
    "mt": "ReplicateStartResult",
    "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

ReplicateNextResult

{
    "api": TableName,
    "mt": "ReplicateAdd",
    "columns": Columns
}

Objects

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.