octoblu / issues

The place to report Octoblu issues
3 stars 2 forks source link

Standardize message format #247

Open brianehlert opened 8 years ago

brianehlert commented 8 years ago

There should be a standard message format for all messages that pass through. The annoyance is working with the key 'params' when following a trigger or working with 'payload' following a device. Not to mention that if you are building a device you can have all of your keys at the root of the message.

It would be more straightforward to simply drop the use of the 'params' and 'payload' keys and only have one message to work with. then there would not have to be additional discovery of keys, nested keys, a dot source path that works after a trigger but not after another node type, and so on.

iamruinous commented 8 years ago

In order to preserve backwards compatibility for triggers, we can also put the params in payload, that should keep it working for everyone else and be better moving forward.

Eventually we can deprecate and eventually remove the params.

iamruinous commented 8 years ago

Deployed, triggers should now have payload as well as params.

redaphid commented 8 years ago

Yeah, we have talked about this a lot. I wish there was a way to do it in general that wouldn't break backwards compatibility.

brianehlert commented 8 years ago

Give me a legacy option on triggers. Everything that already exists, gets it. Everything new, doesn't.

brianehlert commented 8 years ago

But, it is my option. So it is not automatically breaking.

redaphid commented 8 years ago

We talked about that, too. But it might be jarring if, when working on an old flow, you add a new trigger and suddenly it works wildly differently than the others.

I've been working with flow-in-flow communication, which uses triggers to talk to each other. When a flow talks to another flow, the message comes in under the "payload" key! Now at least webhook triggers and device-to-flow trigger messages look similar.

brianehlert commented 8 years ago

@redaphid That is Great! That is a different bug that I put in a while back.

brianehlert commented 8 years ago

The following is interesting after a Trigger Node. Any idea how long this will go on? Or if I need to move from expecting Params to expecting Payload after a Trigger?

{ "msg": { "params": { "action": "exit", "device": "4865B07F-22A4-45E2-8820-364ADEA94F29", "lastname": "Ehlert", "twittername": "@brianehlert", "email": "brian.ehlert@citrix.com", "firstname": "Brian" }, "payload": { "action": "exit", "device": "4865B07F-22A4-45E2-8820-364ADEA94F29", "lastname": "Ehlert", "twittername": "@brianehlert", "email": "brian.ehlert@citrix.com", "firstname": "Brian" } }, "node": "1e30aed0-8a4d-11e5-9499-87ba5e9696de" }