Question

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!

Was it helpful?

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.

OTHER TIPS

I am working on MPC too, but find annoying by API too. Therefore I move the logics, such as disconnecting a specific peer, up to app logic level, from physical connection level. E.g. Session/connection is always on, and just do soft-disconnection by not sending any message to specific peer.

Bluetooth does not perform stably as we all experienced in GKSession. With MPC, we most time used Wifi, therefore connection stability and cost does not matter so much.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top