-
-
-
-
-
-
-
-
-
-#if 0
-
-
-
-
-
-static void wsj1_emit(struct afb_wsj1 *wsj1, int code, const char *id, size_t idlen, struct json_object *data, const char *token)
-{
- json_object *msg;
- const char *txt;
-
- /* pack the message */
- msg = json_object_new_array();
- json_object_array_add(msg, json_object_new_int(code));
- json_object_array_add(msg, json_object_new_string_len(id, (int)idlen));
- json_object_array_add(msg, data);
- if (token)
- json_object_array_add(msg, json_object_new_string(token));
-
- /* emits the reply */
- txt = json_object_to_json_string(msg);
- afb_ws_text(wsj1->ws, txt, strlen(txt));
- json_object_put(msg);
-}
-
-static void wsj1_msg_reply(struct afb_wsj1_msg *msg, int retcode, const char *status, const char *info, json_object *resp)
-{
- const char *token = afb_context_sent_token(&msg->context);
- wsj1_emit(msg->wsj1, retcode, msg->id, msg->idlen, afb_msg_json_reply(status, info, resp, token, NULL), token);
-}
-
-static void wsj1_msg_fail(struct afb_wsj1_msg *msg, const char *status, const char *info)
-{
- wsj1_msg_reply(msg, RETERR, status, info, NULL);
-}
-
-static void wsj1_msg_success(struct afb_wsj1_msg *msg, json_object *obj, const char *info)