Consecutive Callbacks from GET Event

Hi guys,

First project in a while using the Particle platform. I need to access a hosted CSV file using a webhook. I’ve been able to do this for a small amount of data, but I now need to get a CSV that contains about 3000 ASCII characters. When I go into the event stream, I can see that data broken up into multiple events. I can’t work out how to handle the multiple callbacks that get triggered for each of these. I need to parse and process the incoming data, but I’m having problems getting the number of characters passed in each callback. What is the best way to do this?

Welcome to the community.

Each packet will have its own running number (as part of the event name) to ensure you’ll be able to stitch them back together in the correct order.
Also each packet will be delivered as a properly terminated string, so you can use strlen(data) to know how many characters each packet holds.

Whether you want to catch the entire message first and then parse it all at once or do it on the go depends on your data structure, but if possible I’d do the latter to save on static memory.

Thanks ScruffR, managed to get it sorted with those pointers :slight_smile:

1 Like