qie.postMessageResponse¶
Signature: qie.postMessageResponse(response)
Returns: Boolean responsePosted - true = response successfully posted, false = response did not post
Posts a response to the original message sender (an acknowledgement message).
Note
This function should only be used in scripts where the 'message' object is available.
Example when the source node is an HTTP Listener:
var response = "HTTP Status: 404\r\n";
response += "http.header.Content-Type=text/plain\r\n";
response += "http.header.myToken=ABCDEF\r\n";
response += "\r\n";
response += "This is my payload";
qie.postMessageResponse(response);
Note
See this KB article for examples posting a response.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String or byte[] | response | the response to be sent to the sending system |
Example¶
// postMessageResponse Examples:
// Example: response as String
if (qie.awaitingMessageResponse()) {
var responsePosted = qie.postMessageResponse(
"HTTP/1.1 200 OK\r\n" +
"Content-Type: text/plain\r\n" +
"\r\n" +
"I knew you were waiting for me."
);
}
// Example: response as byte[]
if (qie.awaitingMessageResponse()) {
var responseBytes = [
72,84,84,80,47,49,46,49,32,50,48,48,32,79,75,13,10,
67,111,110,116,101,110,116,45,84,121,112,101,58,32,116,101,120,116,47,112,108,97,105,110,13,10,
13,10,
73,32,107,110,101,119,32,121,111,117,32,119,101,114,101,32,119,97,105,116,105,110,103,32,102,111,114,32,109,101,46
]; // HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nI knew you were waiting for me.
var responsePostedWithBytes = qie.postMessageResponse(responseBytes);
}