RTC

Jexia's realtime functionality uses the WebSocket protocol. In JavaScript for example you will need to create a Websocket object. The Websocket constructor has one required parameter which is the URL:

wss://<project-id>.app.jexia.com/rtc?access_token=<access token>

For further information about Websocket consult the Websocket documentation.

All other (common) languages have similar WebSocket client implementations available.

Sending data to the server

All data send to the RTC server uses the JSON format and have the same structure:

  • type - type of message
    • command - send command to RTC
  • data - JSON data depending on type

Commands

Commands have following data fields:

  • command - command to send (see available commands below)
  • arguments - JSON object with  commands arguments (actual fields depend on the command)

Subscribe

Subscribe to the specified events

  • TDB

The following example shows a subscribe command that subscribes to the created, updated and deleted events of mydataset.

{
  "type": "command",
  "data": {
    "command": "subscribe",
    "arguments": {
      "action": [ "created", "updated", "deleted" ],
      "resource": {
        "type": "ds",
        "name": "mydataset"
      }
    }
  }
}

Unsubscribe

TBD

Receiving responses

When messages are received, they will also have the same structure always:

  • type - type of message
    • command ??? - command was processed 
    • event - data in the project got changed
  • data - JSON object containing the information

Commands

The command type has the following data fields:

  • TBD

Events

The event type has the following data fields:

  • action
  • resource
    • type - resource type that is changed, currently it can be
      • ds - dataset
      • fs - fileset
  • modifier - holds information who/what made the change
    • id - unique id of the entity that caused the event
  • data - record data/information. At the moment it only will has one field (change be changed later):
    • id - record that got changed

In this example the event is received when a new record is created in Dataset.

{
  "type": "event",
  "data": {
    "action": "created",
    "resource": {
      "name": "mydataset",
      "type": "ds"
    },
    "modifier": {
      "id": "cb3a519e-c173-4aee-a8e2-11b93cadc033"
    },
    "timestamp": "2019-02-12T13:34:29Z",
    "data": [{
      "id": "1603087e-44a5-4d19-bff0-6b5713845c15"
    }]
  }
}