
 
                 
              Ditto as 
Digital Twin
 "middleware"
{
  "thingId": "io.foo:car1",
  "policyId": "io.foo:car1",
  "attributes": {
    "manufacturer": "Foo corp",
    "productionData": {
      "serialNo": 4711
    }
  },
  "features": {
    "temperature": {
      "properties": {
        "value": 23.42
      }
    }
  }
}JSON repr. of a Thing
GET/PUT/DELETE /api/2/things/io.foo:car1
 /api/2/things/io.foo:car1/thingId
 /api/2/things/io.foo:car1/policyId
 /api/2/things/io.foo:car1/attributes
 /api/2/things/io.foo:car1/attributes/manufacturer
 /api/2/things/io.foo:car1/attributes/productionData
 /api/2/things/io.foo:car1/attributes/productionData/serialNo
 /api/2/things/io.foo:car1/features
 /api/2/things/io.foo:car1/features/temperature
 /api/2/things/io.foo:car1/features/temperature/properties
 /api/2/things/io.foo:car1/features/temperature/properties/value
 
                 
              {
    "policyId": "io.foo:car1-policy",
    "entries": {
      "owner": {
        "subjects": {
          "nginx:admin": {
            "type": "nginx basic auth user"
          }
        },
        "resources": {
          "thing:/": {
            "grant": ["READ","WRITE"],
            "revoke": []
          },
          "thing:/features/firmware": {
            "grant": [],
            "revoke": ["WRITE"]
          },
          "policy:/": {
            "grant": ["READ","WRITE"],
            "revoke": []
          }
        }
      }
    }
  } 
              GET /api/2/search/things
  ?filter=like(attributes/manufacturer,"Foo*")GET /api/2/search/things
  ?filter=and(
    exists(attributes/manufacturer),
    gt(features/temperature/properties/value,23.0)
  )
  &namespaces=io.foo
  &option=sort(-_modified,-attributes/manufacturer)
  &fields=thingId,attributes/manufacturer,_modifiedvar ws = new WebSocket("ws://ditto:ditto@localhost:80/ws/2");
ws.onopen = function(w) {
  w.send('START-SEND-EVENTS?filter=gt(features/temperature/properties/value,25)');
};
ws.onmessage = function(msg) {
  console.log('received: ' + msg.data);
};example of WebSocket browser API
→ docs 
                 
         
           
            Links: