Question with simultaneous Web Servers and AP's.

Posted on
  • Hi!
    I am still learning so I want to apologize in advance if I say something incorrect.

    The thing is, I initialize the Espruino as an AP and create a Web Server with the AP IP address. The pages presented by the Web Server show a list of the nearby Access Points detected by "wifi.scan" in checkboxes. It also has 4 text fields: to introduce the WiFi password, an IP, a Gateway and a Netmask. The customer should select one of the detected WiFi networks and fill the blanks in the four text fields.
    With the inputs submitted by the customer it tries to connect to this new WiFi and creates another WebServer with the IP, gateway and netmask received.

    So, after this process Espruino WiFi should be able to have simultaneously the AP generated by the Espruino and connected to the WiFi network, each one with its Web Server associated. When I create the second page, the first Web Server disappears, and also the Espruino stops working as an AP itself.

    How can I keep both Web Servers active and the Espruino working as an AP also connected to the new WiFi network I receive? Am I missing something important?

    Thanks for the help!

  • I think what you're after is fine to do (it sounds like a great idea), but there might be a minor issue:

    You can only have one web server on Espruino WiFi, although I believe that web server can be accessible from both networks. Because of that, you may need to ensure that you create the Web Server after you've initialised both network interfaces?

    If you're changing configuration (eg to connect to the second interface) I'd close the first server, connect to the AP, and then re-open it...

  • Thanks for replying so fast, Gordon!

    I understand what you are saying. However, I want to create a device with an easy setup/configuration, in which case I need to provide constant feedback. The information submitted (WiFi password, IP, Gateway and Netmask) can be correct or not, and whichever the case is, I need to be able to inform it to the customer, and my only way to communicate is through the web page. If I close the server first, I am unable to inform of the result.
    Also, I need to create the web server before connecting to the second network, because the parameters of the second one are provided by the customer in the web page.

    Any suggestions? Are you planning on implementing something that may help with this issue in the near future?

    Thanks again for the help!

  • I don't see that you'll have a big problem.. You can...

    • Start up AP
    • Start the Web Server
    • User enters details
    • Feedback to user
    • Close Server, start connection
    • User's browser polls server to see if it's back yet
    • connection succeeds(or fails) and server is restarted

    So I think what you're after shouldn't be a big problem...

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Question with simultaneous Web Servers and AP's.

Posted by Avatar for M.Montore @M.Montore