Edge actions - how to return values and "see" the stream

A simple edge action example

function(event) {
  var accelValue = 25;

  return {
    // "cl://accelValue": [ accelValue ] //  --- stream :default {"value":25}
    // "cl://": {                        //  --- Run error: TypeError: wrong type of argument"
    //   key1 : [ 1, 2, 1000],
    //   key2 : [23 ]
    // }
     "cl://john": [{                    //  --- works but I don't know where the data is going
      key1 : [ 1, 2, 1000],
      key2 : [23 ]
    }]
  }

Questions

  • Do I have the event return format correct?
  • where is the doc for the event handler?
  • what do I need to do see the device stream “john” ?

Thanks
John

Ok so I had a think - maybe the payload array can only contain ints, floats and strings
But maybe the server understands JSON in string form

Quick test -

function(event) {
  var obj = { name: "John", age: 30, city: "New York" };
  var myJSON = JSON.stringify(obj);
  console.log(myJSON);
  return {
    "cl://result1" : [myJSON]
  };
}

This seems to be better - device > streams > mydevice > :default I see

14:48:51 13-11-2019
14:48:10 13-11-2019
{"age":30,"city":"New York","name":"John"}
{
  "creationDate": 1573656531579,
  "creatorId": "i000000000000000000000001",
  "elems": {
    "age": 30,
    "city": "New York",
    "name": "John"
  },
  "generatedDate": 1573656490349,
  "hash": null,
  "id": "e5dcc17d31d6bd70a67dea02b",
  "lastEditDate": null,
  "location": null,
  "metadata": null,
  "path": "/iinnovate/devices/john_test_yellow/:default",
  "streamId": "s5db01378b8c3502a9e5c1f35",
  "tags": {
  }
}

Which looks like sensible data to me.

So the next question is how do I stop using :default and use a stream I created?
Should I ask this in a new thread?

PS
note the first time I posted this I missed the “;” of the console.log (too much python lately) the event handler ran twice but then croaked on subsequent calls by the Octave system