|
Boost : |
From: Klemens Morgenstern (klemensdavidmorgenstern_at_[hidden])
Date: 2024-04-10 22:25:07
On Thu, Apr 11, 2024 at 3:23â¯AM Quentin Chateau via Boost
<boost_at_[hidden]> wrote:
>
> A couple of years ago, I wrote packio, a library implementing asynchronous
> client and server for msgpack-rpc. Over time it evolved into something more
> generic, an async implementation of the JSON-RPC (https://www.jsonrpc.org/)
> spec with customizable serialization.
>
> It is built on top of asio, and boost.json is supported serializer. This
> means that with minimal efforts it could evolve into an implementation of
> JSON-RPC with no dependencies outside of boost - yet extendable.
>
> My question then is: is there an interest for it ? I'd probably need to
> invest a non trivial amount of time into making it boost-compliant and
> following up on the review process, so I'm wondering whether it is worth it
> or not.
>
I'd be interested in this library. But you're right, you're in for a
lot of work and then an intense review process.
> Note that there are two known limitations in my library:
> - No support for batch mode
May I ask if you plan to support it in the future?
> - No support for sharing a transport between a client and a server (not
> part of the spec, but requested by some users)
>
> I'm looking forward to get the community's opinion. You can check my
> library on GitHub (https://github.com/qchateau/packio). Feedback on either
> community's interest for such library, or plain comments on the library are
> welcome !
Below are my thoughts when first looking at the example code
- can your library be used with a beast websocket?
server->dispatcher()->add_async(
"multiply",
{allow_extra_arguments, "a", "b"_arg = 2},
[&io](completion_handler complete, int a, int b) {
// Call the completion handler later
packio::net::post(
io, [a, b, complete = std::move(complete)]() mutable {
complete(a * b);
});
});
Do I need to post here to avoid recursion? Is completion_handler an
alias for asio::any_completion_handler?
How do I handle errors? I.e. custom json-rpc server errors.
server->dispatcher()->add_coro(
"pow", io, [](int a, int b) -> packio::net::awaitable<int> {
co_return std::pow(a, b);
})
How do I do error handling here? Throw an exception? I would be very
much interested in system::error_code.
Also: is there anything special about this function, or is it just a
convenience to avoid writing add_async with an asio::co_spawn?
Does async_serve_forever support asio::cancellation_slot?
std::tuple{arg("a") = 42, "b"_arg = 24},
I am not a fan of that syntax. I'd prefer {{"a", 42}, {"b", 24}}
>
> Quentin
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk