FastLED 3.9.15
Loading...
Searching...
No Matches
RpcClient.ino File Reference

Detailed Description

Example demonstrating HTTP streaming RPC client.

This example shows how to:

  • Connect to an HTTP RPC server (e.g., RpcServer.ino)
  • Send RPC requests using SYNC, ASYNC, and ASYNC_STREAM modes
  • Handle responses and streaming updates
  • Manage connection state with callbacks
  • Visualize progress on LEDs

Prerequisites:

  1. Start RpcServer.ino first (on localhost:8080)
  2. Then run this client to connect and send requests
See also
fl/remote/remote.h for full API documentation
fl/stl/asio/http/PROTOCOL.md for protocol specification

Definition in file RpcClient.ino.

+ Include dependency graph for RpcClient.ino:

Go to the source code of this file.

Macros

#define DATA_PIN   3
 
#define NUM_LEDS   10
 
#define SERVER_HOST   "localhost"
 
#define SERVER_PORT   8080
 

Enumerations

enum  TestMode { TEST_SYNC , TEST_ASYNC , TEST_ASYNC_STREAM }
 

Functions

void handleResponse (const fl::json &response)
 
void loop ()
 
void sendAsyncRequest ()
 
void sendAsyncStreamRequest ()
 
void sendSyncRequest ()
 
void setup ()
 

Variables

const uint32_t CALL_INTERVAL = 5000
 
TestMode currentMode = TEST_SYNC
 
int expectedRequestId = -1
 
uint32_t lastCallTime = 0
 
CRGB leds [NUM_LEDS]
 
fl::unique_ptr< fl::Remoteremote
 
int requestId = 1
 
fl::unique_ptr< fl::net::http::HttpStreamClient > transport
 
bool waitingForResponse = false