Offline buffer
While the device is offline, readings are kept on the device and sent in order as soon as the connection is back.
How it works
write() and sendBatch() place each message in a buffer of fixed size. When the connection returns, the buffer is sent oldest first. When the buffer is full, the oldest message is dropped to make room for the newest.
Size it
void setup() {
MaxwellTrack.setQueueSize(8192); // bytes, before begin()
MaxwellTrack.setMaxPayload(1024); // largest single message, 64 to 65535
MaxwellTrack.begin(DEVICE_ID, AUTH_TOKEN, WIFI_SSID, WIFI_PASS);
}
void loop() {
MaxwellTrack.run();
Serial.println(MaxwellTrack.queuedMessages()); // waiting to be sent
Serial.println(MaxwellTrack.droppedMessages()); // lost because the buffer was full
}Defaults per board are in Supported boards. To size the buffer for an outage you expect, watch queuedMessages() during a test disconnect and raise the size until droppedMessages() stays at zero. The OfflineBuffering example shows the whole pattern with connection events.
Something unclear or out of date on this page? Tell support.
