Search code examples
ios7disconnectmultipeer-connectivity

Multipeer Connectivity - programmatically disconnect a peer


I'm converting an application over from GameKit to Multipeer Connectivity and can't seem to find a method that would allow the browser device to disconnect another peer from the session . With GKSession, we could disconnect a single peer from the session using disconnectPeerFromAllPeers:, but I can't find anything like that in MPC. Of course, MPC does have the disconnect: method, but that takes the local peer out of the session..not what I want.

The closest I've found is:cancelConnectPeer: but that seems more focused on canceling a connecting attempt...not post connection.

Anyone know how to do this of if it is even possible with MPC?

Thanks!


Solution

  • A peer can leave a session by calling [MCSession disconnect].

    If you want the browser to disconnect another peer, you could make the browser send a message to that peer, and make the peer disconnect from the session upon receiving that message.