Messaging related utility methods
- Source:
Methods
(static) decode(value, encoding) → {String}
Decodes the specified value and returns it.
Parameters:
Name | Type | Description |
---|---|---|
value |
Buffer | String | The value. |
encoding |
String | The encoding. |
- Source:
Returns:
The decoded value
- Type
- String
(static) decodePayload(message, encodingopt) → {String}
Decodes the specified message's payload and returns it.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
external:Message | The message to parse. |
||
encoding |
String |
<optional> |
utf8 | The encoding to use. |
- Source:
Returns:
The decoded value
- Type
- String
(static) encode(value, encodingopt) → {Buffer}
Encodes the specified value and returns it.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
The value. |
|||
encoding |
String |
<optional> |
utf8 | The encoding of the payload. |
- Source:
Returns:
The encoded value.
- Type
- Buffer
(static) encodePayload(message, value, encodingopt)
Encodes the specified value and places it in the DXL message's payload.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
external:Message | The DXL message. |
||
value |
The value. |
|||
encoding |
String |
<optional> |
utf8 | The encoding of the payload. |
- Source:
(static) jsonPayloadToObject(message, encodingopt) → {Object}
Converts the specified message's payload from JSON to an object and returns it.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
external:Message | The DXL message. |
||
encoding |
String |
<optional> |
utf8 | The encoding of the payload. |
- Source:
Returns:
The object.
- Type
- Object
(static) jsonToObject(jsonString) → {Object}
Converts the specified JSON string to an object and returns it.
Parameters:
Name | Type | Description |
---|---|---|
jsonString |
String | The JSON string. |
- Source:
Returns:
The object
- Type
- Object
(static) objectToJson(obj, prettyPrintopt) → {String}
Converts the specified object to a JSON string and returns it.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
obj |
Object | The object. |
||
prettyPrint |
Boolean |
<optional> |
false | Whether to pretty print the JSON. |
- Source:
Returns:
The JSON string.
- Type
- String
(static) objectToJsonPayload(message, obj, encodingopt)
Converts the specified object to a JSON string and places it in the DXL message's payload.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
external:Message | The DXL message. |
||
obj |
Object | The object. |
||
encoding |
String |
<optional> |
utf8 | The encoding of the payload. |
- Source: