LP#1268619: websockets : gateway log inbound messages at internal
authorBill Erickson <berick@esilibrary.com>
Mon, 3 Mar 2014 21:01:58 +0000 (16:01 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 19 Aug 2014 22:50:48 +0000 (15:50 -0700)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

src/gateway/osrf_websocket_translator.c

index 7aa8676..0d06bd4 100644 (file)
@@ -653,6 +653,8 @@ static char* extract_inbound_messages(
 
     // here we do an extra json round-trip to get the data
     // in a form osrf_message_deserialize can understand
+    // TODO: consider a version of osrf_message_init which can 
+    // accept a jsonObject* instead of a JSON string.
     char *osrf_msg_json = jsonObjectToJSON(osrf_msg);
     osrf_message_deserialize(osrf_msg_json, msg_list, num_msgs);
     free(osrf_msg_json);
@@ -749,6 +751,8 @@ static size_t on_message_handler_body(void *data,
     memcpy(buf, buffer, buffer_size);
     buf[buffer_size] = '\0';
 
+    osrfLogInternal(OSRF_LOG_MARK, "WS received inbound message: %s", buf);
+
     msg_wrapper = jsonParse(buf);
 
     if (msg_wrapper == NULL) {
@@ -816,6 +820,9 @@ static size_t on_message_handler_body(void *data,
     msg_body = extract_inbound_messages(
         r, service, thread, recipient, osrf_msg);
 
+    osrfLogInternal(OSRF_LOG_MARK, 
+        "WS relaying inbound message: %s", msg_body);
+
     transport_message *tmsg = message_init(
         msg_body, NULL, thread, recipient, NULL);