I have some successes and failures. I wanted to say the tracker sample you made is a tour de force, really good work.
My question is: what is a good sample to begin with for sockets? It can be any github. The reason I want to use sockets, is Hologram charges more for SMS, and https sends a lot more data I am charged for, but don’t need.
The https sample did work for me. I currently trying to modify it to use a socket. The changes look as simple as replacing one line:
this: ret = http_client_req(fd, &req, timeout, NULL);
with this: ssize_t plength = zsock_send(fd, msg, sizeof(msg), 0);
However, I haven’t got that far because I am now getting these connection errors - “connect() function”. Sometimes a timeout, bad argument, refused, etc. The cause could be Hologram.
Ona side note. The sms sample was failing with uninitiailized modem. I put in a manual call and that fixed it. I swapped in the the blocking call “nrf_modem_at_cmd()” and that fixed my other issue.
In the https sample, I changing the json for Hologram. The fw then rebooted at the connection call. I took out all the cJSON calls out and just formatting the json string, and no more resets. I might be using the cJSON API wrong though.
//my code
cJSON *obj = cJSON_CreateObject();
cJSON_AddStringToObject(obj, "devicekey", data->devicekey);
cJSON_AddStringToObject(obj, "data", data->payload);
cJSON_AddStringToObject(obj, "tags", data->topic0);
char *msg = cJSON_PrintUnformatted(obj);
cJSON_Delete(obj);