-static struct json_object *api_ws_server_req_json(struct api_ws_server_req *wreq);
-static struct afb_arg api_ws_server_req_get(struct api_ws_server_req *wreq, const char *name);
-static void api_ws_server_req_success(struct api_ws_server_req *wreq, struct json_object *obj, const char *info);
-static void api_ws_server_req_fail(struct api_ws_server_req *wreq, const char *status, const char *info);
-static const char *api_ws_server_req_raw(struct api_ws_server_req *wreq, size_t *size);
-static void api_ws_server_req_send(struct api_ws_server_req *wreq, const char *buffer, size_t size);
-static void api_ws_server_req_addref(struct api_ws_server_req *wreq);
-static void api_ws_server_req_unref(struct api_ws_server_req *wreq);
-static int api_ws_server_req_subscribe(struct api_ws_server_req *wreq, struct afb_event event);
-static int api_ws_server_req_unsubscribe(struct api_ws_server_req *wreq, struct afb_event event);
-static void api_ws_server_req_subcall(struct api_ws_server_req *wreq, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *closure);
-
-const struct afb_req_itf afb_api_ws_req_itf = {
- .json = (void*)api_ws_server_req_json,
- .get = (void*)api_ws_server_req_get,
- .success = (void*)api_ws_server_req_success,
- .fail = (void*)api_ws_server_req_fail,
- .raw = (void*)api_ws_server_req_raw,
- .send = (void*)api_ws_server_req_send,
- .context_get = (void*)afb_context_get,
- .context_set = (void*)afb_context_set,
- .addref = (void*)api_ws_server_req_addref,
- .unref = (void*)api_ws_server_req_unref,
- .session_close = (void*)afb_context_close,
- .session_set_LOA = (void*)afb_context_change_loa,
- .subscribe = (void*)api_ws_server_req_subscribe,
- .unsubscribe = (void*)api_ws_server_req_unsubscribe,
- .subcall = (void*)api_ws_server_req_subcall
+static void api_ws_server_req_success_cb(struct afb_xreq *xreq, struct json_object *obj, const char *info);
+static void api_ws_server_req_fail_cb(struct afb_xreq *xreq, const char *status, const char *info);
+static void api_ws_server_req_destroy_cb(struct afb_xreq *xreq);
+static int api_ws_server_req_subscribe_cb(struct afb_xreq *xreq, struct afb_event event);
+static int api_ws_server_req_unsubscribe_cb(struct afb_xreq *xreq, struct afb_event event);
+
+const struct afb_xreq_query_itf afb_api_ws_xreq_itf = {
+ .success = api_ws_server_req_success_cb,
+ .fail = api_ws_server_req_fail_cb,
+ .unref = api_ws_server_req_destroy_cb,
+ .subscribe = api_ws_server_req_subscribe_cb,
+ .unsubscribe = api_ws_server_req_unsubscribe_cb