Shared buffer implication

In the Electron reference documentation there is the following statement: “Particle.publish() and the Particle.subscribe() handler(s) share the same buffer. As such, calling Particle.publish() within a Particle.subscribe() handler will wipe the subscribe buffer! In these cases, copying the subscribe buffer’s content to a separate char buffer prior to calling Particle.publish() is recommended.”

I’m assuming that the contents of the buffer that would get wiped would the ‘data’ component of the published event. Am I correct?

I ask because I have a particular event that one Electron publishes every 10 minutes as a ‘keep alive’ signal to a second Electron, i.e. it serves to indicate that the communications link between them is healthy. If no event is seen by the second Electron within 10 minutes, it logs a link failure to a Google spreadsheet and sends a notification to a smart phone, both via IFTTT.

The data component of the event is irrelevant and thus is not referenced at all in my code; it is simply the arrival of the event at the second Electron that accomplished the objective (see my event handler code below).

I’ve been seeing an occasional illogical result with the logging of link failures (specifically, a link failure and subsequent link restoration both in the same minute) that I have so far been unable to diagnose and I want to rule out the shared buffer as a possible source of the issue.

Can someone please confirm that the buffer behavior would not manifest itself in my event handler?

void myHandler(const char *event, const char *data)
{
    lastPumpUpdate = millis();
    if ( linkUp == false ){
        Particle.publish("Link", "Up", PRIVATE);
        linkUp = true;
    }
}

This code should not cause any issues.

Thanks, ScruffR! I was pretty sure it wouldn’t, but secretly I was hoping that it would for the simple reason that I cannot for the life of me find any other explanation.

Brian Shaw