Apologies if this question appears to be too vague but I would like to know the key differences between these two clients.

While WiFiClient comes pre-loaded with Arduino IDE, HttpClient doesn't. Also, to send HTTP commands to a server (XML/JSON), which one to go for?


WiFiClient provides a raw connection to the internet through a WiFi access point (such as your home router).

HttpClient provides a connection to a web server via an existing Client connection, such as a WiFiClient connection.

So the simplest answer to your question

to send HTTP commands to a server (XML/JSON), which one to go for?

is "Use both".

You use WiFiClient to connect to the internet, then you use HttpClient on your WiFiClient connection to communicate with a website. As it states in the readme on HttpClient's github repository:

Because it expects an object of type Client, you can use it with any of the networking classes that derive from that. Which means it will work with EthernetClient, WiFiClient and GSMClient.

To understand the concept more fully you will first need to understand the OSI 7-Layer Model which is essential reading for anyone doing anything with networking software.

  • Can you tell me why aren't they using HttpClient on top of EthernetClient over here: gist.githubusercontent.com/jamesabruce/8bc9faf3c06e30c3f6fc/raw/… – Hyperbola Mar 1 '16 at 11:14
  • 1
    @Hyperbola Because you don't have to use HttpClient. You can do it all yourself manually if you like. HttpClient just saves you the hassle is all. – Majenko Mar 1 '16 at 11:15
  • Thanks @Majenko. I have a question posted too regarding Philips Hue; if you could look at it once. – Hyperbola Mar 1 '16 at 11:18
  • 1
    @Hyperbola I have no clue what a Philips Hue is nor how you communicate with it. I would recommend starting simpler and trying to send a GET request to somewhere like Google before dabbling into unknown boxes of tricks. – Majenko Mar 1 '16 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.