Hello!
I just got ultra confused about the part of the project that I am currently working on...It's about making HTTP request from C# app (acting as a client) to an ESP8266 which has to respond with JSON.
-
I started with simple one, which was just responding to request like ("http://192.168.8.135") - just requesting ESP's IP adress. It worked fine, with usage of <ArduinoJson.h> I got beautiful JSON file in response.
I used:
WiFiServer server(80);
server.begin();
while(client.avaiilable())
... -
Then I found out that I need to distinguish TWO DIFFERENT requests coming from my C#app ( client ).
Let's say one is ".../getFileList" and second ".../getCoords?fileName=123".
And here is where the problems started occuring. I got confused about WiFiServer vs ESP8266WebServer. Why the first one has direct access to .client and lets me do sth like: serializeJsonPretty(doc, client);
while the second one can only call server.handleClient() in loop method ? :o
The way I understood that: with ESP8266WebServer we can handle different requests with a nice method: server.on("","<method_name_to_handle_that>". So I would like to mix that with being able to print to a specific client that has just send me a request.
The question is: how am I able to respond to client DEPENDING ON REQUEST it sent ?
Which type of server would it be?
Please help, any tips will be appreciated...
Thanks!