Set subscribe handler data as global

Hi ScruffR, hmm… could it be the stack has a limit to store subscribed variables ? If so, then instead of using so many subscribe handlers I will try to combine them into a single subscribe then… as what you did with your code, you stored temp and press into enum… it does seem complicated for me since it is my first time seeing enum being used.
I will try to understand the enum part before applying it to my code…

Update, I think ill combine temp and press publish into one function and publish them!

Update 3 - I finally understand the webhook example!
Sub “D8”
Pub “D8_Door/D8_temp/D8_press”!
Because particle sub handlers will foo - food, foo, fool, foodprata, as long as the subscribed event name contains the specified name. Now my im able to use
void d8_handler(const char event, const char data)
if(strstr(event,“temperature”){
log.trace("%s, %s",event,data)
}
Update 4 - I can get the data now… I’ve observed that i have string data ! I converted them to float for temp and press vals, and to char str. I also used (!strcmp(event, “D8_temp”)) instead of
(strstr(event, "temp)) !

void env_data(){
    temp = bmp.readTemperature();
    press = bmp.readPressure();
   
    char envdata[128];  
    snprintf(envdata, sizeof(envdata), "%.2f~%.2f", temp, press);
    Particle.publish("D8_data", envdata, PRIVATE);
}