1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Updated Node msg Conventions (markdown)

knolleary 2014-10-31 06:24:26 -07:00
parent 534b5ced24
commit 31a2afb217

@ -1,15 +1,18 @@
There are a few reserved properties within the structure of the msg objects being passed around in node-RED.
* **msg.payload** - contains the main body of the message. For example, the text of a Tweet, the content of a webpage or a sensor reading.
* **msg.title** - a title giving a good representation of what the message contains.
* **msg.description** - a brief explanation of what data is contained within the message.
* **msg.data** - storage for raw, unparsed data. This may have come from an API call and is included to give more advanced users options to access data which might not have been deemed entirely neccessary for all users.
* **msg.data** - some APIs provide large responses. For example, the Twitter api returns a huge object for each tweet containing many properties beyond just the text. This property can be used to store the original response - allowing access to all of the properties, not just those that get pulled out into `msg.payload`.
* **msg.payload** - Storage for parsed and organised data with meaningful and understandable properties for direct access by other nodes.
* **msg.location** - an object containing properties representing location information.
* **msg.location.lat** - Latitude
* **msg.location.lon** - Longitude
* **msg.location.name** - the name of a location
* **msg.location.city**
* **msg.location.country**
* **msg.lat** - Reserved for latitudes. It should be a string representation of a number between the range of -90 and 90. It can have several decimal places, but doesn't need to.
* **msg.lon** - Reserved for longitudes. It should be a string representation of a number between the range of -180 and 180. It can also have several decimal places, but doesn't need to.
* **msg.time** - Reserved for times. The time should be a javascript Date object.
* **msg.time** - a time. The time should be either JavaScript Date object, or a number of milliseconds since epoch.