Particle subscription to get a varibale

I wouldn’t copy a string like that since you are going to clobber memory. Instead try this:

char   myGlobalData[20];

void myHandler(const char *event, const char * data)
{
   strncpy(myGlobalData, data, sizeof(myGlobalData));
   myGlobalData[sizeof(myGlobalData) - 1] = '\0';
}

Notice that I reserved a character buffer of 20 bytes and then did a limited copy into that buffer of no more than 20 bytes. Add the terminating null just in case the input was longer than 20. Make your array big enough to handle whatever data you are receiving, the 20 here is just an example.

Code defensively.