-/* called when wsj1 receives a method invocation */
-void AFBClient::onCall(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
-{
- UNUSED(closure);
- int rc;
- printf("ON-CALL %s/%s:\n%s\n", api, verb,
- json_object_to_json_string_ext(afb_wsj1_msg_object_j(msg),
- JSON_C_TO_STRING_PRETTY));
- fflush(stdout);
- rc = afb_wsj1_reply_error_s(msg, "\"unimplemented\"", NULL);
- if (rc < 0)
- fprintf(stderr, "replying failed: %m\n");
-}
-
-/* called when wsj1 receives an event */
-void AFBClient::onEvent(void *closure, const char *event, afb_wsj1_msg *msg)
-{
- UNUSED(closure);
- printf("ON-EVENT %s:\n%s\n", event,
- json_object_to_json_string_ext(afb_wsj1_msg_object_j(msg),
- JSON_C_TO_STRING_PRETTY));
- fflush(stdout);
-}
-
-/* called when wsj1 hangsup */
-void AFBClient::onHangup(void *closure, afb_wsj1 *wsj1)
-{
- UNUSED(closure);
- UNUSED(wsj1);
- printf("ON-HANGUP\n");
- fflush(stdout);
- exit(0);
-}
-
-/* called when wsj1 receives a reply */
-void AFBClient::onReply(void *closure, afb_wsj1_msg *msg)
-{
- printf("ON-REPLY %s: %s\n%s\n", (char*)closure,
- afb_wsj1_msg_is_reply_ok(msg) ? "OK" : "ERROR",
- json_object_to_json_string_ext(afb_wsj1_msg_object_j(msg),
- JSON_C_TO_STRING_PRETTY));
- fflush(stdout);
- free(closure);
-}
-