No callback on http request #4668
Replies: 1 comment
-
Posted at 2015-05-10 by DrAzzy First, try a site that doesn't do anything weird (like google.com does) Failing that, post your code (be sure to snip out your wifi password). What network adapter are you using? ESP or Wiznet? I know it works on v78 with the ESP8266 Posted at 2015-05-10 by Schweigi Ups. I forgot to call
But I still have some issues with the post call not ending. I think its because of the Mandrill API. The following sample code (POST req. to Requestbin) is working. The console prints the status code (200) after the request:
But when I do the same for the Mandrill API then the post request is not ending. Mandrill gets the request successfully but its seems that the Espruino is still waiting for a response:
I will try to investigate further. The same request (http & https) using a rest-client (Postman) is working correctly. Posted at 2015-05-10 by Schweigi I re-routed the http request form the Pico trough a proxy on my computer. The request itself is working but the Pico doesn't seem to close the connection. Also sometimes (10% of the time) not all the payload data is sent (it gets stuck at 272 bytes). I added a
I guess this error is the problem. But I don't know where its coming from. Posted at 2015-05-10 by @gfwilliams Hm, not sure about the link error you're getting (Espruino seems to be finding the error message from the Esp8266 and trying to close the connection). However I think usually Espruino waits for the server to close the connection rather than counting bytes from content length - it usually sends the Posted at 2015-05-10 by Schweigi I checked. The
While debugging I also found three other issues. I can reproduce those with a simple GET call. Just attach a ESP8266WiFi to your Pico and press the build-in button to trigger a request.
Btw my Pico firmware has 1v78 and the ESP8266 has 0018000902-AI03. Posted at 2015-05-10 by DrAzzy espruino/EspruinoDocs#138 <-multiple requests don't work because the Esp8266WiFi module doesn't manage the callbacks correctly for multiple connections. Posted at 2015-05-10 by Schweigi My issue (1) is if the requests are serial, not parallel. So only one request at a time. Posted at 2015-05-10 by Schweigi I finally found it. I used a breadboard for all my experiments with the ESP8266 on it. Apparently this was the issue. After soldering the ESP8266 to a shim all communication errors are gone. One small issue I mentioned in my previous post (issue (2)) is still left. When there is no Posted at 2015-05-11 by @gfwilliams
No, I reckon that's a bug - thanks for letting me know! I'll get a fix in for that. Posted at 2015-05-11 by @gfwilliams Ok, fix now in. It'll be in the 1v79 release, or you can get it from the GitHub builds |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-05-10 by Schweigi
It seems that the callback of
require("http").request
is not executed. When usingrequire("http").get
then the callback is executed. I use the Pico with 1v78. Originally I wanted to make a post request but never got a response so I tried to reproduce it with the get command.Remark: It looks like the forum engine injects a
http://
in front of the host name.Callback is executed for:
Callback (print status code) is not executed for:
Does somebody know how to solve this?
Beta Was this translation helpful? Give feedback.
All reactions