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

◆ sendAsyncRequest()

void sendAsyncRequest ( )

Definition at line 150 of file RpcClient.ino.

150 {
151 Serial.println("=== Testing ASYNC mode: longTask(2000) ===");
152
153 // Create JSON-RPC request
154 fl::json request;
155 request["jsonrpc"] = "2.0";
156 request["method"] = "longTask";
157 fl::json params;
158 params.push_back(2000); // 2 second task
159 request["params"] = params;
160 request["id"] = requestId;
161
163 waitingForResponse = true;
164
165 transport->writeResponse(request);
166
167 fl::printf("Sent request ID %d: longTask(2000)\n", expectedRequestId);
168 Serial.println("Expecting ACK immediately, then result after 2 seconds...");
169}
int requestId
bool waitingForResponse
int expectedRequestId
Definition RpcClient.ino:62
fl::unique_ptr< fl::net::http::HttpStreamClient > transport
Definition RpcClient.ino:42
void push_back(const json &value) FL_NOEXCEPT
Definition json.h:745
void printf(const char *format, const Args &... args) FL_NOEXCEPT
Printf-like formatting function that prints directly to the platform output.
Definition stdio.h:635
#define Serial
Definition serial.h:304

References expectedRequestId, fl::printf(), fl::json::push_back(), requestId, Serial, transport, and waitingForResponse.

Referenced by loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: