Photon and wifi

am using photon in my project
my q is
how I can make the photon reconnect to the cloud again wen there is internet?
so wen I have internet I want it to be connecting to cloud and when there is no internet I want it to work also ,so wen the internet come I want it to reconnect to cloud again ?
I tried the
before setup(void)
it works with out internet or cloud but wen there is internet it not reconnecting to cloud again
how I can make it like that Auto to work with internt cloud and with out ,

You can stick with AUTOMATIC when you use it in conjunction with SYSTEM_THREAD(ENABLED).

You can also use the functions shown in the docs, to probe for WiFi and Internet and/or the Particle cloud
Just have a look there

There are also lots of similar questions that can be found with the search feature of this forum :wink: