+static void wsreq_reply(struct afb_xreq *xreq, struct json_object *object, const char *error, const char *info)
+{
+ struct afb_wsreq *wsreq = CONTAINER_OF_XREQ(struct afb_wsreq, xreq);
+ int rc;
+ struct json_object *reply;
+
+ /* create the reply */
+ reply = afb_msg_json_reply(object, error, info, &xreq->context);
+
+ rc = (error ? afb_wsj1_reply_error_j : afb_wsj1_reply_ok_j)(
+ wsreq->msgj1, reply, NULL);
+ if (rc)
+ ERROR("Can't send reply: %m");
+}
+
+static int wsreq_subscribe(struct afb_xreq *xreq, struct afb_event_x2 *event)