FastLED 3.9.15
Loading...
Searching...
No Matches

◆ sendStreamUpdate()

void fl::Remote::sendStreamUpdate ( const char * method,
const fl::json & update )

Send stream update for a streaming async method (ASYNC_STREAM mode) The request ID is automatically retrieved from internal storage.

Definition at line 58 of file remote.cpp.hpp.

58 {
59 fl::string methodName(method);
60 auto it = mAsyncRequests.find(methodName);
61 if (it == mAsyncRequests.end()) {
62 FL_WARN("No pending async request for method: " << method);
63 return;
64 }
65
66 int requestId = it->second.requestId;
67 // Don't erase - stream is still active
68
69 // Build JSON-RPC response with "update" marker
70 fl::json response = fl::json::object();
71 response.set("jsonrpc", "2.0");
72 response.set("id", requestId);
73
74 fl::json resultObj = fl::json::object();
75 resultObj.set("update", update);
76 response.set("result", resultObj);
77
78 // Send via response sink
79 if (mResponseSink) {
80 mResponseSink(response);
81 FL_DBG("Sent stream update for " << method << " (id=" << requestId << ")");
82 }
83}
int requestId
size_t update(u32 currentTimeMs)
Main update: pull + tick + push (overrides Server::update)
fl::unordered_map< fl::string, AsyncRequest > mAsyncRequests
Definition remote.h:201
ResponseSink mResponseSink
Definition server.h:89
void set(const fl::string &key, const json &value) FL_NOEXCEPT
Definition json.h:701
static json object() FL_NOEXCEPT
Definition json.h:692
#define FL_WARN(X)
Definition log.h:276
#define FL_DBG
Definition log.h:388

References FL_DBG, FL_WARN, mAsyncRequests, fl::Server::mResponseSink, fl::json::object(), requestId, fl::json::set(), and update().

+ Here is the call graph for this function: