As I understand it, you can only send one payload with each MQTT message. Why not send 2 separate messages each with a payload where the payload contains an identifier indicating that it is one of a pair and which pair it belongs to ?
Yep, already thought of that but just trying to understand if there is another way around it.
PubSubClient has beginPublish which described as "Begins sending a publish message. The payload of the message is provided by one or more calls to write followed by a call to endPublish ." but I am not sure if they try to buffer the whole message before sending it though which is exactly what can't be handled given the lack of RAM.
Just trying to send a subset of CAN message signals (could be 1000's on a given vehicle) to AWS for remote monitoring.
Micromod Teensy can handle the CAN traffic just need something to send the data.
Very difficult to find a small form factor NB modem with the chip shortage. So I am trying to use the MKR1500 MB handle the modem, TLS security(built in crypto) and the MQTT messaging. The Micromod Teensy is handling the JSON encoding as the calculated signals reside in the RAM (has 1MB).
150 signals/s is like 2K bytes/second of data in a JSON format which and NB modem should be able to handle very easily.
But I need to know the full message size before the fact which I need to communicate to MKR in advance.
So essentially I need to buffer the message in the host twice.
Need to create the JSON in a buffer so I know the size and then buffer in the UART so I do not block the host after the message is generated but waiting for the MKR to receive the data and send it.