The Multipeer Connectivity Framework documentation is a bit lacking. Below I have several questions about connections and relaying.
In order to make things easier, I created an image for each question. The legend is as follows:
For each of the questions, keep these in mind:
- If I disable bluetooth, does the answer change?
- If I disable wi-fi, does the answer change?
- If I disconnect from the same wi-fi network, does the answer change?
1. If you connect to one peer, do you get connected to every other peer?
Assume 1 and 2 were connected to a session.
If 1 and 3 connect, do 2 and 3 get connected?
2. What if you already had your own session with peers?
Assume 1 and 2 were connected to a session, and 3 and 4 were connected to a different session.
If 1 and 3 connect, do all peers get connected to each other? (e.g. do 2 and 4 get connected?)
3. What happens if two connected devices are no longer in range?
Assume 1, 2, and 3 are all connected and in range of each other.
If 3 moves out of range of 1 (but still in range of 2), do 1 and 3 get disconnected?
Note: For this question assume that they are using device to device communication, not a centralized wi-fi.
3b. If not, does this mean that every message that 1 sends to 3 get relayed through 2, or will 3 simply not get any messages?
4. What if the connection is initiated and some devices aren't in range of each other?
Assume 1 and 2 are in range of each other, 2 and 3 are in range of each other, but 1 and 3 are out of range of each other. Assume 1 and 2 are connected to a session, but 3 is not.
If 3 connects to 2, will it get connected to 1 as well?
5. Are advertisements relayed through peers as well?
Again, 1 and 2 are in range, 2 and 3 are in range, but 1 and 3 are out of range.
If 1 advertises its services, will 3 see it (e.g. by it relaying through peer 2)?
5b. If 2 was also advertising, would this change the answer to the above question? I.e. will 3 see 1's advertisement?
6. What about browsers, are they ever relayed through peers?
Again, 1 and 2 are in range, 2 and 3 are in range, but 1 and 3 are out of range.
If 3 advertises its services, will 1 see it (e.g. by it relaying through peer 2)?
6b. If 2 was also browsing, would this change the answer to the above question? I.e. will 1 see 3's advertisement?