serializeJson()
accepts a Print&
, i.e, a reference to a class that implements the Print
interface.
WiFiClient
does implement the Print
interface, but serializeJson()
cannot make a reference to it because ESP8266WebServer::client()
returns a temporary. Indeed, C++ forbids references to temporary variables, only const
reference to temporaries are allowed.
To fix this compilation error, you must extract a variable:
WiFiClient client = server.client();
serializeJson(doc, client);
The way I see it, ESP8266WebServer::client()
should return a WiFiClient&
instead of a WiFiClient
, just as HTTPClient::getStream()
does. I opened issue #7075 about that.
Anyway, even it this fixes the compilation, I'm not sure it will work as you intend because ESP8266WebServer
may not allow writing directly to the WiFiClient
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4