ChipChop Support Forum
Log in
Log out
Join the forum
My Details
REPLIES: 3
VIEWS: 323
BACK
REPLY TO THIS POST
Tomin
18 Feb 2025
Bug in library ?
Hi folks.

Just walking through a code and see:

void ChipChopEngine:: _respond_to_status_request(const String& message_id){
    .....
int obj_length = 5;
_JSON obj[obj_length] = {
{"api_call","\"heartbeat\""},
{"command","\"status_response\""},
{"uuid",_quote + _UUID + _quote},
{"device_id",_quote + _DEVICE_ID + _quote},
{"message_id",_quote + message_id + _quote},
{"status",status}
};

Maybe I am oversight something, but
should not be there obj_length = 6 ???
Gizmo
18 Feb 2025

Hey Mr T,

Well I'll be damned...at last someone is actually looking at the library code!

Yes, well spotted, you are absolutely correct, it should be 6 but it will also never error ;-)

The _respond_to_status_request is just a placeholder method and it's currently never invoked by the ChipChop API server(s).

I've been kinda planning ahead for a possibility where there may be a need to explicitly request the status from the device regardless where it is in it's status sending cycle (the heartbeat cycle is usually at 10sec but can be a lot lot longer). For example if you have a device that is quite passive and only occasionally sends it's status (once a day, week, month) this would be a method to manually request the full status through the App or Dev Console.

Thank you for pointing out the mistake, I wasn't planning on using that exact name "_respond_to_status_request" so it wouldn't cause a problem anyway if it becomes a feature in some future version of the library but it's definitely there to keep annoying me so one day I would implement the functionality.

Anyways, I am working on a new custom binary TCP communication protocol that will eventually fully replace WebSockets or mqtt and I am going to put this on my todo list as it's really simple to implement just need to think how/where you would invoke it (maybe if I have the time I could make it even more complex and expand it to be some sort of mini "IoT SSH"?)

Oh, before you ask, same story is for "302_api_redirect", that's also a placeholder for potential server proxying i.e. if you have a device too far from your primary API server a closer one could take the workload to reduce latency (this is more relevant for commercial/research/scientific applications when devices are spread across continents)

What are you making at the moment (was it solar stuff you were into?)

Tomin
18 Feb 2025

Thanks for the answer. I am glad to help.

Yes. I am trying to create an implementation ChipChop into my Triton. ;-)
I would like to write another topic for some enhancement questions and so on later.

Many thanks for your product. It is amazing.
Gizmo
18 Feb 2025
ACCEPTED

Good to hear that you like this little platform (there will be many new features coming this year)

Let me know if I can help in any way

G