api.parse
api.parse(data [,messagetype] [,splitArrays])
Description
Parses data and returns it as a message(s) without publishing to 1Gateway. The arguments can either be (data), (data, messageType), (data, splitArrays) or (data, messageType, splitArrays).
Parameters
| Parameter | Type | Explanation |
|---|---|---|
| data | Object | The data that gets sent in the message |
| messagetype | String | The message_type of the message (located in headers/metadata) |
| splitArrays | Boolean | If true, it will split an array into multiple message instead of one |
Example
msg = api.parse("Hello world")
api.publish(msg, "HelloMessageType")