You are reading a single comment by @Tobbe and its replies. Click here to read the full conversation.
  • I'm doing two get-requests. As soon as I've gotten an answer from the first one I want to do the second one. So something like this

    http.get(url, function (res) {
      res.on('data', function (chunk) { ... });
      res.on('close', function () {
        http.get(url2, function (res) {
          res.on('data', function (chunk) { ... });
          res.on('close', function () {
            console.log('both get-requests completed');
          });
        });
      });
    });
    

    However, it doesn't work :( I get this:

    ERROR: Socket error -1 while sending
    Uncaught Error: CIPSTART failed
     at line 1 col 177
    ...d 0,Error("CIPSTART failed");}
                                   ^
    in function "b" called from line 1 col 26
    {d=void 0;var f;b&&(f=b(a))?(d=p,b=f):clearTimeout(e);­void 0...
                              ^
    in function "d" called from line 1 col 325
    ...c&&(e[c](k),n=!0);n||d&&d(k)}a=a.subs­tr(f+1);"\n"==a[0]&&(a=...
                                   ^
    in function called from system
    

    I can work around it by wrapping the inner get-call in a setTimeout, but that doesn't feel right. What's the correct way to do this?

About

Avatar for Tobbe @Tobbe started