Hi there,
I have problem sending a http response back to the client.
My setup is as follows: Since the WiFi module on my EspruinoWiFi is broken, I wired an external ESP8266 module to the board. I create an access point and after that an http server by calling http.createServer((req, res) => {...}).listen(80)
Now my problem:
When I connect to the AccessPoint and send a http GET request to my Esprunino, it gets the request data.
But when I call res.writeHead(200, { 'Content-Type': 'text/plain'}); res.write('Foo'); res.end(); in succession the client never gets any response and the connection seems to stay open forever. Am I doing s.th. wrong?
For debug purposes I registered Event listeners on req.on('end', () => {...}), req.on('close', () => {...}), res.on('end', () => {...}) and res.on('close', () => {...}).
The events are getting called in the following order:
request.end
response.end
request.close
response.close
Seems to me, that nothing is going wrong. I'm using the latest firmware (v95). Does anyone has a solution for this? Thank you in advance
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi there,
I have problem sending a http response back to the client.
My setup is as follows: Since the WiFi module on my EspruinoWiFi is broken, I wired an external ESP8266 module to the board. I create an access point and after that an http server by calling http.createServer((req, res) => {...}).listen(80)
Now my problem:
When I connect to the AccessPoint and send a http GET request to my Esprunino, it gets the request data.
But when I call res.writeHead(200, { 'Content-Type': 'text/plain'}); res.write('Foo'); res.end(); in succession the client never gets any response and the connection seems to stay open forever. Am I doing s.th. wrong?
For debug purposes I registered Event listeners on req.on('end', () => {...}), req.on('close', () => {...}), res.on('end', () => {...}) and res.on('close', () => {...}).
The events are getting called in the following order:
request.end
response.end
request.close
response.close
Seems to me, that nothing is going wrong. I'm using the latest firmware (v95). Does anyone has a solution for this? Thank you in advance