agoo_server_gpublish(agooErr err, const char *subject, gqlRef event) {
    gqlSub	sub;
    gqlType	type;

    if (NULL == gql_type_func || NULL == (type = gql_type_func(event))) {
	return agoo_err_set(err, AGOO_ERR_TYPE, "Not able to determine the type for a GraphQL publish.");
    }
    pthread_mutex_lock(&agoo_server.up_lock);
    for (sub = agoo_server.gsub_list; NULL != sub; sub = sub->next) {
	if (subject_check(sub->subject, subject)) {
	    agooRes	res;
	    agooText	t;

	    if (NULL == (res = agoo_res_create(sub->con))) {
		AGOO_ERR_MEM(err, "Response");
		break;
	    }
	    if (NULL == (t = gpub_eval(err, sub->query, event))) {
		break;
	    }
	    res->con_kind = AGOO_CON_ANY;
	    agoo_res_message_push(res, t);
	    agoo_con_res_append(sub->con, res);
	}
    }
    pthread_mutex_unlock(&agoo_server.up_lock);

    return err->code;
}
agoo_server_gpublish(agooErr err, const char *subject, gqlRef event) {
    gqlSub	sub;
    gqlType	type;

    if (NULL == gql_type_func || NULL == (type = gql_type_func(event))) {
	return agoo_err_set(err, AGOO_ERR_TYPE, "Not able to determine the type for a GraphQL publish.");
    }
    pthread_mutex_lock(&agoo_server.up_lock);
    for (sub = agoo_server.gsub_list; NULL != sub; sub = sub->next) {
	if (subject_check(sub->subject, subject)) {
	    agooRes	res;
	    agooText	t;

	    if (NULL == (res = agoo_res_create(sub->con))) {
		AGOO_ERR_MEM(err, "Response");
		break;
	    }
	    if (NULL == (t = gpub_eval(err, sub->query, event))) {
		break;
	    }
	    res->con_kind = AGOO_CON_ANY;
	    agoo_res_message_push(res, t);
	    agoo_con_res_append(sub->con, res);
	}
    }
    pthread_mutex_unlock(&agoo_server.up_lock);

    return err->code;
}