Is Particle.connect() Asynchronous?

I check the reference document and it seems that Particle.connect() is not async and will block the main loop.

My case is: Electron devices are used in a place where the cellular signal is weak and I don’t want the main loop will be delayed by this reason. Any solutions? Thanks.

Random thought: xenon running code and electron handling connection like a router?
Or maybe
An M0 arm microprocessor collecting data and keeping time, while the electron ‘reconnects’

When using SYSTEM_THREAD(ENABLED) and/or SYSTEM_MODE() other than AUTOMATIC then it is async.

With SYSTEM_MODE(SEMI_AUTOMATIC) things can get a bit “murky”.
Depending on device OS version the system sometimes holds off of calling loop() (again) before the connection is reestablished - hence I usually test the behaviour case-to-case :slight_smile:

However, since the communication with the cellular module impacts the over all performance of the system during connection attempts, it’s best to monitor the connection status and actively disconnect from the network when you detect multiple failed attempts to reconnect.

BTW, Particle.connect() is usually not taking most the time. It’s typically the implicit Cellular.connect() part that takes the longest.