|
FastLED 3.9.15
|
| void fl::Rpc::bindAsync | ( | const char * | name, |
| fl::function< void(ResponseSend &, const json &)> | fn, | ||
| fl::RpcMode | mode = fl::RpcMode::ASYNC ) |
Bind async method with ResponseSend& parameter (for ASYNC/ASYNC_STREAM modes) Signature: void(ResponseSend&, const json&) The ResponseSend& parameter is automatically injected with request ID and response sink The json& parameter contains the raw JSON params from the request.
EXAMPLE: rpc.bindAsync("longTask", [](ResponseSend& send, const json& params) { // ACK already sent automatically // Do work... send.send(json::object().set("value", 42)); // Send result });
Definition at line 32 of file rpc.cpp.hpp.
References fl::invoke(), fl::make_shared(), fl::make_tuple(), fl::detail::RpcEntry::mDescription, fl::detail::RpcEntry::mInvoker, fl::detail::RpcEntry::mIsResponseAware, fl::detail::RpcEntry::mMode, fl::fl::move(), mRegistry, fl::detail::RpcEntry::mResponseAwareFn, fl::detail::RpcEntry::mSchemaGenerator, fl::detail::RpcEntry::mTags, fl::detail::RpcEntry::mTypeTag, and fl::TypeConversionResult::success().
Here is the call graph for this function: