How to manage UWB connections with multiple devices

I want to develop a demo of uwb which can be run across multiple iPhones. In the video of WWDC it is said that for each device, a distinctive NISession is needed. I tried to generate two different NISessions, but I found that the discoveryToken for each session is different. That made me confused because I thought each device should have only one single token. Can anyone tell me how to manage multiple UWB connections at the same time? Thanks in advance.
You are on the right track. Follow these steps to perform interaction with multiple iPhones:
  1. Create an NISession for each peer you would like to interact with. For example, if you are interacting with two peers, create 2 * NISession objects.

  2. Each NISession will have a unique NIDiscoveryToken associated with it. Share discovery token #1 with peer #1, and share discovery token #2 with peer #2.

  3. When you receive discovery tokens from peers #1 and #2, create 2 * NINearbyPeerConfiguration objects and use them to run sessions #1 and #2, respectively.

When it comes to receiving updates from the session objects, it might make sense to set the delegate property of both sessions to be the same entity (e.g. your ViewController). You can disambiguate which session provided an update by inspecting the session parameter given in the delegate callback.
How to manage UWB connections with multiple devices
 
 
Q