# 04-22 Try different fixes.
# Final assessment of connection refusal
Yesterday I figured out that there the httpclient library does not work when called from a function that is not in the main file. When I upload a fake measurement as down in the function body of the setup function there are no issues. It is not possible to invoke it from an external function or class.
void setup() {
MeasurementWebservice testWS;
// works just fine, but only like this
IpsMeasurement test( "12312313123", 12);
testWS.addToQueue(bruhh);
testWS.store();
}
According to this github issue, there seems to be something wrong with invoking the httpclient from an external function. This github issue also describes refused connections, but it is apparently due to using BLE and wifi at the same time. This is probably not the issue though, because the main issue seems to stack overflows. The libraries are very expensive.
using wificlientsecure directly instead of using the httpclient as a wrapper works. It is possible to print the minified json to the wifi connection to the server.
# Backend Logging issue
In the backend the program wasnt making any log files. I find them helpful for debugging. I had to change ownership to www-data user and make my non-sudo user join the www group so that apache could write to server. The file permissions are now 644 and folder permissions for /vendor and /storage files are both 755.
# Next steps
I merged the https-upload-measurements client branch to dev even though it technically doesnt work as intended. My plan is to replace it with a async httpclient anyway, so I think it is okay to just move on from here.