Does anyone have an example of a web server?

jpan127
Posts: 8
Joined: Sat Aug 26, 2017 10:11 pm

Does anyone have an example of a web server?

Postby jpan127 » Mon Sep 04, 2017 6:20 pm

I am looking for an example of the ESP32 being able to display html/javascript on a web page for example: 192.168.1.250

I actually have no idea of this concept so any pointers to what concepts to look at would be appreciated. I think the ESP32 would need to be a web server and process HTTP requests.

I have looked at Kolban's C++ snippets on HTTP and they seem thorough but I have some trouble understanding what's going on. If you see this Kolban, I just sent you an email inquiring about possibly doing a video tutorial on this topic, it would be greatly appreciated.

For starters I would like to understand what is required to get this set up. So far, I think the ESP32 should listen on port 80 for HTTP requests, process them, and return html/javascript? However it does seem much more complicated than that.

Thanks!

User avatar
iot-bits.com
Posts: 25
Joined: Wed Dec 21, 2016 6:14 am
Location: India
Contact:

Re: Does anyone have an example of a web server?

Postby iot-bits.com » Thu Sep 07, 2017 6:54 am

I ported HTTPD to ESP32 and the sockets work fine, but the code is very unstable right now. Plus I don't know what would be the best way to store files. SD card?
- Pratik
:geek: Just another hobbyist and consultant

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Does anyone have an example of a web server?

Postby kolban » Thu Sep 07, 2017 2:29 pm

I am working on a sample that is an HTTP Server with WebSockets and file access ... as a library that is built and consumable from C++.

See .. https://github.com/nkolban/esp32-snippe ... Server.cpp

However ... as of September 7th 2017, it is not ready for consumption. It is what I am actively tinkering with ... should expect it to be ready for play in October.

Again, this is just another HTTP server ... and we are already awash in those. My goal in re-inventing the wheel here is to 100% leverage C++ and make it 100% C++ based (classes, callbacks, encapsulation etc etc).
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

sukeshak
Posts: 50
Joined: Sat Aug 19, 2017 10:20 am
Contact:

Re: Does anyone have an example of a web server?

Postby sukeshak » Fri Sep 08, 2017 9:58 am

Is this something we can use directly? Not looked into yet.

http://www.freertos.org/FreeRTOS-Plus/F ... ver.html?0

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Does anyone have an example of a web server?

Postby cmorgan » Fri Sep 15, 2017 1:37 pm

I'm having good luck with libesphttpd. The esp-idf branch is what you want. You'll want to put that into the esp-idf/components/ folder like esp-idf/components/libesphttpd and then look at the README.md for how to pass it an array of urls and initialize it.

In the near future I'll be pushing out a version with ssl (https) support as well as Linux support in case you'd like to test/debug under Linux.

You can find it at https://github.com/Spritetm/libesphttpd, my fork is at https://github.com/chmorgan/libesphttpd

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Does anyone have an example of a web server?

Postby cmorgan » Fri Sep 15, 2017 1:42 pm

Oh, and libesphttpd also supports bundling and compressing files to a in-flash filesystem. This makes it super easy to include your resources in your project like images etc by simply putting them into a target folder and letting libesphttpd leverage heatshrink and gzip to compress and build them into a filesystem object that is built directly into your output application image.

If you run into any issues please let me know.

cmorgan wrote:I'm having good luck with libesphttpd. The esp-idf branch is what you want. You'll want to put that into the esp-idf/components/ folder like esp-idf/components/libesphttpd and then look at the README.md for how to pass it an array of urls and initialize it.

In the near future I'll be pushing out a version with ssl (https) support as well as Linux support in case you'd like to test/debug under Linux.

You can find it at https://github.com/Spritetm/libesphttpd, my fork is at https://github.com/chmorgan/libesphttpd

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Does anyone have an example of a web server?

Postby WiFive » Fri Sep 15, 2017 3:53 pm

cmorgan wrote:
In the near future I'll be pushing out a version with ssl (https) support
Sounds good. And wss:// too?

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Does anyone have an example of a web server?

Postby cmorgan » Fri Sep 15, 2017 6:40 pm

WiFive wrote:
cmorgan wrote:
In the near future I'll be pushing out a version with ssl (https) support
Sounds good. And wss:// too?
Yep, it uses the same transport portions of the server so wss:// comes for free when you enable SSL mode.

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Does anyone have an example of a web server?

Postby cmorgan » Fri Sep 15, 2017 7:29 pm

WiFive wrote:
cmorgan wrote:
In the near future I'll be pushing out a version with ssl (https) support
Sounds good. And wss:// too?
Alright, pushed the changes out to https://github.com/chmorgan/libesphttpd ... f_chmorgan if you'd like to give it a test spin. It's working well here.

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Does anyone have an example of a web server?

Postby cmorgan » Sat Sep 16, 2017 4:57 pm

I also pushed out an example of using libesphttpd under Linux at https://github.com/chmorgan/libesphttpd_linux_example

Who is online

Users browsing this forum: acsoprana, Baidu [Spider] and 90 guests