• function pageRequest(req, res) {
      res.end("Hello World");
    require("http").createServer(pageRequest­).listen(8080); // port 8080

    The code like this, when the borad work, it's ok for visiting the pages which the server supply at the very first time. But when I jump for the other websites and visit back via return history of browser, the server stop. I can't visit the server website again. I have to invoke load() for restart then I access the server again.

    How to Keep web server working for long time?

  • Tue 2020.09.22

    Hi, @user109783

    it sounds like this is what you are after:

    Espruino WebServer Module

    Other ideas:

    HTTP File Server
    WiFi Websocket Server



    'How to Keep web server working for long time?'

    After a bit of digging, this page seems to be the origin of the snippet above:


    As page requests are 'stateless' I now believe the initial post is after attempting to keep the connection alive indefinetly.

    Good overview,


    Is this the task that is being attempted?


    Is a very large char count page request being made and not all of the page content is returned?

  • The page I load is very simple and little cotent, I just press the F5 for refreshing the website, but somehow the server reject for connecting.

    And I invoked WIZnet.getStatus(), it was still working.

      state: "online",
      id: "W5500",
      phylink: "up",
      phypowmode: "normal",
      by: 0, mode: 1, speed: 100, duplex: 0 }

    But when I visit website by http://ip , the browser reject like this: ERR_CONNECTION_REFUSED

  • When I first time visited the device like this,
    Ok,no matter how I pressed the F5 button for refreshing, the connection was ok.
    But when I write a new website like: http://www.google.com and then press the back history for visiting the again, it failed, the browser rejected for visiting, maybe the device did.

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

How to keep a continuous web access while using require("http").createServer

Posted by Avatar for user109783 @user109783