How to add data to a message with different send times?

Hello I have to send a msg.payload that I need to add data with different send times.

Because i send data to server every 3 seconds and i need include all data in one message.

Example:

message1 ="hi1"; //this message should be added every 3 seconds
message2 ="hi2"; //this message should be added every 6 seconds
message3 ="hi3";//this message should be added every 9 seconds

pseudo Code

if(message1.Time>=3){msg.payload=msg.payload+message1;}
if(message2.Time>=6){msg.payload=msg.payload+message2;}
if(message1.Time>=9){msg.payload=msg.payload+message9;}

return msg;

Your requirements to "include all data in one message" and "send data every 3 seconds" are conflicting.

After 3 seconds "hi1_1" message has arrived. Should you wait until "h2_1" and "hi3_1" arrive or send it without? If waiting, what do you want to do with "h1_2" and "h1_3"?

Is duplicated output data acceptable?
At 12 seconds a "hi1_4" message and "hi2_2" message arrive - NOT precisely simultaneously.
Sould you send
"hi1_4", "hi2_1", "hi3_1"
then
"hi1_4", "hi2_2", "hi3_1"

Hmm. Given the season, should it be ho1, ho2, ho3? :grinning:

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.