Does Blynk.connected() give instantaneous connection status?

I’m trying to store messages in a buffer when my device loses its connection to the cloud server. Then when it becomes connected again output the stored messages to the terminal widget. My question is… When I call Blynk.connected() is there a short period where this function call will report that it’s still connected (as the device figures out that it’s lost connection) or is it instantaneous?

Generally Blynk commands are instantaneous (within network/internet lag constraints).

Connection status may be dependent on heartbeat settings.

What are your testing methodologies and results?


I’m just starting to troubleshoot. I basically check connection. Then immediately either write to terminal or save to a buffer depending on the connection status. I seem to be missing messages right when the device disconnects. I began to suspect (as you suggested) that it might be tied to heartbeat and therefore have a short delay before returning false. In which case my program would wrongly attempt to write to terminal instead of the buffer. I plan to investigate further with some statiegically placed serial prints.

But I’m also thinking maybe I should just save everything to the array buffer of say the last 25 messages (FIFO) and do a terminal.clear() and terminal.write() from the buffer array every successful reconnect and every time I get a new message. Or maybe 25 writes to terminal all at once would flood the server?

I wish there was some way to know if the terminal.write() was succcessful or not.

Short of seeing it on the terminal… :stuck_out_tongue_winking_eye:

I prefer to use a direct Blynk.virtualWrite(vPin, "my string data"); to the terminal as that seems to work more reliably and no need for flush.

Very funny :rofl: I was thinking more along the lines of getting a true/false returned from the terminal.write() command based on success. But I suspect the actual writing to the server happens in

There is no send receipt feedback to the device for any virtual commands that I am aware of.