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

◆ sendSyncRequest()

void sendSyncRequest ( )

Definition at line 127 of file RpcClient.ino.

127 {
128 Serial.println("=== Testing SYNC mode: add(2, 3) ===");
129
130 // Create JSON-RPC request manually (client doesn't have Remote::call() yet)
131 fl::json request;
132 request["jsonrpc"] = "2.0";
133 request["method"] = "add";
134 fl::json params;
135 params.push_back(2);
136 params.push_back(3);
137 request["params"] = params;
138 request["id"] = requestId;
139
141 waitingForResponse = true;
142
143 // Send request via transport
144 transport->writeResponse(request); // writeResponse sends JSON to server
145
146 fl::printf("Sent request ID %d: add(2, 3)\n", expectedRequestId);
147 Serial.println("Waiting for response...");
148}
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: