Connecting to Google App Engine #3665
Replies: 16 comments
-
Posted at 2014-02-20 by hansamann This is strange, but using the "raw" request method it does work. I am posting this here so others can have an example of how to use the request method:
Unfortunately I have a new problem - will create a new thread for that. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by @gfwilliams Great! glad you got it working! It looks like there's some kind of issue with
I'll look into that - should be an easy fix which will be in 1v52. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by hansamann Thx Gordon, very cool. BTW would there be a way to extendn the request function to be able to include Request Headers - and potentially access teh response headers? In general I am super super super happy not to have to deal with the parsing of the raw response, e.g. data in the on('data') even contains the pure body of the response, not the raw headers around it (that's so painful on Arduino). But I assume sometimes it woudl be nice to access headers. e..g. res.body woudl be the body, by res.headers a map with the headers. In another post I mentioned that I have issues with the stability. I get erros from the CC3000 but once these happens I have no way to restart the device, other than pressing reset. And especially here in an office environment, the likelihood to get the CC3000 connected and a few requests sent out is very low. The max. number of consecutive post requests I was able to send is two :-) then the CC3000 crashed and all stopped. Any idea? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by @gfwilliams Are you using 1v51 of Espruino? That had some changes that really improved stability. I've also done a few more tweaks that'll appear in 1v52 and that should improve matters fuirther. Also are you sure you're connecting to VBat and not 3.3v, as the 3.3v regulator won't supply enough power for the CC3000... As far as the request headers, they're pre-parsed in
and
The only thing you can't do currently is easily get the 'body' of the HTTP server request. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by hansamann Hi @gfwilliams, yes 1.51. THX for vbat, i had 3.3 To 3.3 and VIN in cc3000 to vbat. Removed the one cable now, I'll see if that makes it better. For headers I was thinking outgoing requests, e.g. setting the headers to a request for a remote server call. Will report later once I am home. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by @gfwilliams
Looks like you can do that too, just like node.js - not that I remember implementing it :) Untested, but:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by hansamann Hi @gfwilliams, the "hidden" headers feature is cool, thx! I am now at home, e.g. a "nice" WiFi environment with only a few devices. I just implemented a tiny counter in the request calls and the maximum requests before it somehow stalled is 22. I have a 2 second delay between the requests right now. The espruino is still working btw, I have a toggle on an LED (interval) and the LED is still flashing. But the 23 request now does not seem to be able to complete. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by @gfwilliams Try the new firmware suggestion from the other post - it might help... Otherwise, are you only initiating another setTimeout when the request completes successfully, or are you using setInterval? setInterval would be better, as a request may well fail at some point because of the connection (but hopefully the next one will succeed). |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by hansamann I seem to be not successful with the Xively - I used a REST client which gave me the info that it works with HTTP, too, so I gave it a try: PUT http://api.xively.com/v2/feeds/1848857974 in JS it looks like this - but was not able to get a request through:
Yes, I posted my API key. Don't care, this is for testing. Feel free to use exactly the same key. The feed is also public, e.g. can be accessed via https://xively.com/feeds/1848857974 I made a few test calls via RESTclient, so some data is there. But unfortunately did not get a request through via the Espruino+CC3000. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-21 by @gfwilliams The main issue was that you wrote
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-21 by @gfwilliams Also, just to point out that it wanted a content-length too. It seems to work well. I'll have to get something set up now ;) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-06 by @gfwilliams I just added something here, using a DHT11 sensor: http://www.espruino.com/wifi_humidity |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-09 by hansamann Thx @gfwilliams. I took that tutorial as a base. I added a LDR to track the light intensity and also a super simple soil sensor (could be done with two nails). After experimenting with Solar-powered, I burnt a CC3000 or it was just time for that one to die... and I am still fighting the stability. It runs a few hours sometimes, but then I am unlucky and it will stop just after I left (like today). A nicely resetting CC3000 without removing all timers in case of an error would be awesome. It is still great now, I just have to hit the reset button from time to time. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-10 by @gfwilliams Yes, I'll look at that. This is the failure you get when it gives error code |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-10 by hansamann Not quite sure what you mean with error code 1 - it is the CC3000 issue that happens when connect (most likely) is called. It seems to drop all watches and intervals then, which means the device does not run the "sendToXively" function any more. Thx again! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-11 by @gfwilliams Yes, that's what I found - as in another post, this should be fixed in 1v56... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-19 by hansamann
Hi all,
I am very often using Google App Engine to host APIs and I have an API up here
http://hybrisiot.appspot.com/shelves/default
If you call this with a browser or curl, it will respond with a bunch of JSON. It will take longer upon the first request because GAE just fires up the app, but then from the second request it is pretty fast.
Now, with the CC3000 connected, I try to get that JSON response. But I get this in the console:
ERROR: Unable to locate host
ERROR: Timeout in CC3000 driver (4107)
Looks like CC3000 has died again. Power cycling...
Below is the espruino js code.
require("http").get("http://hybrisiot.appspot.com/shelves/default", function(res) {
res.on('data', function(data) {
console.log(data);
});
});
I also tried to use the raw request method - could someone maybe also post an example for a POST with url-encoded body? That woudl be awesome.
Beta Was this translation helpful? Give feedback.
All reactions