SkillzSyncDelegate Protocol Reference

Conforms to NSObject
Declared in Skillz+SyncPlay.h

Overview

The object you pass into the delegate argument of initWithGameId:forDelegate:withEnvironment:allowExit: should conform to this protocol.

User Connection Management

– onOpponentHasReconnected: required method

This method will be called when the opponent player has successfully reconnected within the timeout. This will allow you to resume the game.

- (void)onOpponentHasReconnected:(SKZSyncPlayerId)playerId

Parameters

playerId

Id of player who has reconnected

Discussion

Note: This method will be called from a background thread.

Declared In

Skillz+SyncPlay.h

– onOpponentHasLostConnection: required method

This method will be called when the opponent player’s connection has failed and Skillz is attempting to reconnect This will allow you to pause the game while waiting for the player to reconnect.

- (void)onOpponentHasLostConnection:(SKZSyncPlayerId)playerId

Parameters

playerId

Id of player who is attempting to reconnect

Discussion

Note: This method will be called from a background thread.

Declared In

Skillz+SyncPlay.h

– onOpponentHasLeftMatch: required method

This method will be called when the opponent player leaves the match (due to connection failure or abort) and is unable to rejoin. At this point, Skillz handles the player as if they have aborted. At this point your game should gracefully end the match and report the current player’s score.

- (void)onOpponentHasLeftMatch:(SKZSyncPlayerId)playerId

Parameters

playerId

Id of player who has permanently left the match

Discussion

Note: If you receive this message without a corresponding “onOpponentHasLostConnection:” call, you should assume the player has manually aborted.

Note: This method will be called from a background thread.

Declared In

Skillz+SyncPlay.h

– onCurrentPlayerHasReconnected required method

This method will be called when the current player has successfully reconnected within the timeout. This will allow you to resume the game.

- (void)onCurrentPlayerHasReconnected

Discussion

Note: This method will be called from a background thread.

Declared In

Skillz+SyncPlay.h

– onCurrentPlayerHasLostConnection required method

This method will be called when the current player’s connection has failed and Skillz is attempting to reconnect This will allow you to pause the game while waiting for the player to reconnect.

- (void)onCurrentPlayerHasLostConnection

Discussion

Note: This method will be called from a background thread.

Declared In

Skillz+SyncPlay.h

– onCurrentPlayerHasLeftMatch required method

This method will be called when the current player leaves the match (due to connection failure or abort) and is unable to rejoin. At this point, Skillz handles the player as if they have aborted.

- (void)onCurrentPlayerHasLeftMatch

Discussion

Note: You should follow up by calling “notifyPlayerAbortWithCompletion:” at your convenience.

Note: This method will be called from a background thread.

Declared In

Skillz+SyncPlay.h

– onDidReceiveData:

When another instance of your client connected to the same match passes a message using the below sendData:, this method will be called on all other clients.

- (void)onDidReceiveData:(NSData *_Nonnull)data

Parameters

data

The message sent by your client

Discussion

Note: This method will be called from a background thread.

Declared In

Skillz+SyncPlay.h

– onMatchCompleted

This method will be triggered on all clients when one client has explicitly reported a score or aborted.

- (void)onMatchCompleted

Discussion

Note: This method will be called from a background thread.

Declared In

Skillz+SyncPlay.h