static void on_pws_event_subscribe(void *closure, void *request, const char *event_name, int event_id);
static void on_pws_event_unsubscribe(void *closure, void *request, const char *event_name, int event_id);
static void on_pws_event_push(void *closure, const char *event_name, int event_id, struct json_object *data);
-static void on_pws_event_broadcast(void *closure, const char *event_name, struct json_object *data);
+static void on_pws_event_broadcast(void *closure, const char *event_name, struct json_object *data, const afb_proto_ws_uuid_t uuid, uint8_t hop);
static void idle();
static int process_stdin();
fflush(stdout);
}
-static void on_pws_event_broadcast(void *closure, const char *event_name, struct json_object *data)
+static void on_pws_event_broadcast(void *closure, const char *event_name, struct json_object *data, const afb_proto_ws_uuid_t uuid, uint8_t hop)
{
if (raw)
printf("ON-EVENT-BROADCAST: [%s]\n%s\n", event_name, json_object_to_json_string_ext(data, JSON_C_TO_STRING_NOSLASHESCAPE));
char *key;
int rc;
struct json_object *o;
+ enum json_tokener_error jerr;
/* allocates an id for the request */
rc = asprintf(&key, "%d:%s", ++num, verb);
/* send the request */
callcount++;
- if (object == NULL || object[0] == 0 || !strcmp(object, "null"))
+ if (object == NULL || object[0] == 0)
o = NULL;
else {
- o = json_tokener_parse(object);
- if (!o)
+ o = json_tokener_parse_verbose(object, &jerr);
+ if (jerr != json_tokener_success)
o = json_object_new_string(object);
}
rc = afb_proto_ws_client_call(pws, verb, o, sessionid, key, NULL);