I see that there is a TCPclient built in to the spark core but cant figure out what the format is. There were many posts relating to this but have so much difference in the code.
Good question! There's a great thread here where a bunch of community members are building a Http Client library. We're working out some bugs, but that would be a great place to start!
Using this Http Client in WEB IDE leads to 8RED code death for me immediately after cloud connect
Local toolchain build works fine
I have no idea why this fails in WEB
Problem is Http Client is pretty small. I can’t see why it should fail memory imediatelly after core starts even on low memory. This is a good chance to investigate while it is reproducable.
It’s because you are instantiating a TCP Client which had a decent size buffer. Then your code that uses your library probably declares another buffer. Pretty soon you are all out of RAM
It is not pretty soon, it is imediately. TCPClient client.connect is either failing either not even reached. How much RAM is availbe in WEB Ide on 0.2.2? less 1Kb?
I’m not an expert but I did my best when writing HttpClient to keep RAM usage low. However, it has a fairly large buffer by default — it’s 1K — which is because most people seemed to download a lot of data (webpages and such). If you are just using a REST API, chances are you can decrease the buffer a lot in size and free up some memory.
There are at least a couple dozen people that have reached out to me for different reasons after using the library, so I’m assuming more than that get by, and most don’t seem to have many issues.