43 template<
typename Callable>
84 template<typename Callable>
90 template<
typename Callable>
107 return mRpc.get<Sig>(name);
129 size_t update(u32 currentTimeMs);
132 size_t tick(u32 currentTimeMs);
156 return mRpc.schema();
ClearFlags
Flags for FastLED.clear() to control what state gets cleared/reset.
void sendStreamFinal(const char *method, const fl::json &result)
Send final stream response for a streaming async method (ASYNC_STREAM mode) The request ID is automat...
void bind(const Config< Callable > &config)
Register method with config (name, function, optional metadata)
void recordResult(const fl::string &funcName, const fl::json &result, u32 scheduledAt, u32 receivedAt, u32 executedAt, bool wasScheduled)
size_t tick(u32 currentTimeMs)
Process scheduled calls (call regularly)
typename fl::Rpc::Config< Callable > Config
Configuration for method registration (forwards to Rpc::Config)
fl::net::RpcScheduler mScheduler
fl::BindResult< Sig > get(const char *name) const
Get bound method by name for direct C++ invocation.
Remote(Remote &&) FL_NOEXCEPT=delete
bool has(const fl::string &name) const
Check if method is registered.
void scheduleFunction(u32 timestamp, u32 receivedAt, const fl::json &jsonRpcRequest)
Remote(const Remote &) FL_NOEXCEPT=delete
size_t pendingCount() const
Get number of pending scheduled calls.
fl::MethodInfo MethodInfo
fl::unordered_map< fl::string, AsyncRequest > mAsyncRequests
fl::json schema() const
Returns flat schema document Format: {"schema": [["methodName", "returnType", [["param1",...
fl::RemoteClearFlags ClearFlags
void bind(const char *name, Callable fn, fl::RpcMode mode=fl::RpcMode::SYNC)
Register method by name, function, and optional mode (default SYNC)
fl::vector< MethodInfo > methods() const
Get method information for all registered methods.
void bindAsync(const char *name, fl::function< void(fl::ResponseSend &, const fl::json &)> fn, fl::RpcMode mode=fl::RpcMode::ASYNC)
Register async method with ResponseSend& parameter (for ASYNC/ASYNC_STREAM modes) Signature: void(Res...
void reportError(const fl::string &message)
Send an error notification to the remote peer.
void sendAsyncResponse(const char *method, const fl::json &result)
Send async response for a previously-called async method The request ID is automatically retrieved fr...
void sendStreamUpdate(const char *method, const fl::json &update)
Send stream update for a streaming async method (ASYNC_STREAM mode) The request ID is automatically r...
fl::vector< RpcResult > mResults
bool unbind(const fl::string &name)
Unregister method by name.
fl::size count() const
Get number of registered methods.
void clear(ClearFlags flags)
Clear state (bitwise OR of ClearFlags)
fl::json processRpc(const fl::json &request)
Process JSON-RPC request (with optional "timestamp" field for scheduling) Returns JSON-RPC response: ...
Remote(RequestSource source, ResponseSink sink)
Construct with I/O callbacks.
Helper class for sending responses in async/streaming RPC methods.
size_t update()
Main update: pull + push.
fl::function< fl::optional< fl::json >()> RequestSource
Server() FL_NOEXCEPT
Default constructor.
fl::function< void(const fl::json &)> ResponseSink
Generic time-based task scheduler.
FastLED's Elegant JSON Library: fl::json
constexpr remove_reference< T >::type && move(T &&t) FL_NOEXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
RemoteClearFlags
Flags for clearing Remote state (can be OR'd together)
Base definition for an LED controller.
Method parameter information.
Wraps the result of binding to a method by name.
Configuration for method registration with optional metadata.
Result metadata for executed RPC calls.