0

I have an app where a peer to peer network is created. There is a leader and members. If a member leaves, it just disconnects itself with session.disconnect(). But if the leader leaves, I want all the other members to get disconnected from each other as well.

Disconnect individual peers from MCSession?

I've seen this post for an Objective-C solution to disconnecting other peers, but didn't understand it. Can someone give me a good way to disconnect all peers of the session.connectedPeers at once?

swift-lynx
  • 3,219
  • 3
  • 26
  • 45
  • 3
    I think you can manage this scenario by sending some specific text/code to all the user, before the leader leaves. Based on that text/code you can call session.disconnect() for every user. – Bhavik Modi May 15 '19 at 07:34
  • @BhavikModi yes, but isn't there an easier solution? – swift-lynx May 15 '19 at 07:38
  • Can you please just explain how do you making connection between users? For eg. Many users connecting to 1 or A connecting to B, B connecting to C. – Bhavik Modi May 15 '19 at 08:56

0 Answers0