ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By l3xluthor
#5934 Hi Sprite_tm:

I have followed your work and I think is really nice, thanks for sharing it, well now after testing the CHERTS guide to compile on windows and since I wasnt able to compile the webpages.espfs there, now I have the enviromnet on ubuntu and all is working good, I have done some changes in the htmls and now Im running the server-client app. I have one ESP running as server where I can see in a table the IP, the label of the device(no yet finished) and a button to switch on/off things as starting point, so I have something like this on the server:

IP-------------------Device Label --------------Switch
192.168.4.101---Whatever1------------------Button "ON/OFF"
(Any device connected to the ESP running as server will be listed here using wifi_softap_get_station_info())

The idea was to send an http request when the button is clicked using your ajax code in the next way: (actually I can see the request, but theres no response)

xhr.open("GET", "http://"+deviceIP+"/wifi/setligth.cgi");// the URL was added, also the cgi function linked to the URL

But it seems that the ESP playing the server role cant reach the server part of the ESP connected as the CLIENT, I thought that avoiding to get the module in STA-only mode on resetTimerCb function will allow me to call the function of the http request, but is not working :? .

So, the question is if the httpd project will be able to enable that bi-directional comunication between ESPs acting as CLIENT and SERVER at the same time? Any thought about how I can accomplish that? That means I have to get connected from the SERVER to esp acting as CLIENT to run some functions there(I mean with SSID and pass...)?
Last edited by l3xluthor on Tue Dec 30, 2014 9:16 am, edited 2 times in total.
User avatar
By Sprite_tm
#5972
folny82 wrote:Hello

I want to ask aka, the maximum file size webpages.espfs ? because if my files larger than 140kB so esphttpd does not work.


Off the top of my head (can't check from here) 120K or so is the max. The makefile should check the size, but that's only slightly tested.
User avatar
By Sprite_tm
#5974
l3xluthor wrote:xhr.open("GET", "http://"+deviceIP+"/wifi/setligth.cgi");// the URL was added, also the cgi function linked to the URL

That's not gonna work because of Javascript security; I think it's called the same-origin policy. I think there are workarounds for that; I'm not a Javascript expert though. Mind you, if it would work, it's not the ESP connecting to the other ESP; it's your browser requesting a page from the other ESP.
But it seems that the ESP playing the server role cant reach the server part of the ESP connected as the CLIENT, I thought that avoiding to get the module in STA-only mode on resetTimerCb function will allow me to call the function of the http request, but is not working :? .

So, the question is if the httpd project will be able to enable that bi-directional comunication between ESPs acting as CLIENT and SERVER at the same time? Any thought about how I can accomplish that? That means I have to get connected from the SERVER to esp acting as CLIENT to run some functions there(I mean with SSID and pass...)?


Depends, what are you trying to do? If both ESPs are on the same network, they should be able to connect just fine; all you'd need is a protocol inbetween the two; I'll leave creating one or making a HTTP client to you. If not, you'd have to fiddle around with AP+STA mode and make connections on the fly; I'm not sure how good an idea that would be.