Session Modes

In the preceding section, you learned how to connect to a peer without using the Peer Picker. Part of creating a new GKSession was specifying a sessionMode; in the previous example, the mode supplied was GKSessionModePeer. There are three types of sessionModes that can be supplied.

GKSessionModePeer acts like the Peer Picker. It looks for a peer at the same time as it allows other peers to find it. Either side can initiate the connection when working with a GKSessionModePeer.

GKSessionModeServer acts differently than GKSessionModePeer. In this mode the GKSession will not look for other peers but will make itself available to be connected to by peers that are searching.

GKSessionModeClient is the reverse of GKSessionModeServer. It ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.