How does remotely claiming work, from a technical standpoint?

I have a question out of curiosity - if I have a device that I’ve unclaimed (but it remains online) and then after some period of time I run particle device add from my computer, how do Particle’s servers instantly find this WiFi connected device out in the wild and have it show up in my console?

Or perhaps asked more specifically, when connected to the internet, are unclaimed devices still essentially maintaining the same connection to Particle’s servers that claimed devices do? I used this feature recently and realized my brain cannot seem to put together how/why exactly this works!

Edit: Instead of some heavyweight server connection for unclaimed devices, I imagine Particle must have some kind of lookup database of last-known IP address of each device - something like that, right?

There are two aspects to this:

Developer (non-product) devices

An unclaimed developer device has a full cloud connection, but published events basically disappear because no one can listen for the event, since it’s unclaimed.

No one can send events to, call functions, read variables, or OTA an unclaimed developer device.

A full cloud connection is maintained because the claim process can only be done when the device is online and breathing cyan, and from the cloud standpoint every device that’s online is kept track of whether claimed or not.

Product devices

We now recommend that you do not claim product devices to an account. Variables, functions, and OTA work with unclaimed devices because they have product membership, and the product controls these things. As of early 2023, publish and subscribe work properly with unclaimed devices as well.

There are two exceptions to this suggestion:

  • Product firmware developers may want to claim devices to their own account so they can flash product devices that have Mark as Development set from Workbench or the Web IDE
  • If you are using customer accounts from a mobile app so you can make Particle API calls on behalf of your customer directly from the mobile app. We don’t recommend doing this anymore, as it’s generally better to make the API calls from your back-end, but it is a reason to claim to a customer account.

If you do device to claim devices to an account, it’s often common to claim all devices to a single account. This is mainly for historical reasons from the time when unclaimed product devices could not receive events. However, for product devices, particle device add works even if the device is offline if the claiming user is a team member of the product.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.