C++ Client APIs
- initialize
- SetPollingMode
- update
- connect
- disconnect
- initUDP
- joinLobby
- leaveLobby
- subscribeLobby
- unsubscribeLobby
- joinRoom
- joinRoomWithNUser
- joinRoomInUserRange
- leaveRoom
- createRoom
- deleteRoom
- setRecoveryAllowance
- subscribeRoom
- unsubscribeRoom
- sendChat
- sendPrivateChat
- sendUpdate
- sendMove
- getLiveRoomInfo
- getLiveUserInfo
- getLiveLobbyInfo
- setCustomUserData
- setCustomRoomData
- updateRoomProperties
- lockProperties
- unlockProperties
- getOnlineUsers
- recoverConnection
- createTurnRoom
- startGame
- stopGame
- getMoveHistory
- getAllRooms
- getRoomWithNUser
- getRoomsInUserRange
- getRoomWithProperties
- setZoneRequestListener
- setRoomRequestListener
- setLobbyRequestListener
- setNotificationListener
- setConnectionRequestListener
- setUpdateRequestListener
- setChatRequestListener
static void initialize ( std::string apiKey , std::string s2Address );
Parameters
apiKey - The Application key given when the application was created. s2Address - The IP address of the server where the AppWarp S2 zone is hosted.
Returns
void
void SetPollingMode( bool mode );
Parameters
mode - True / False
Returns
void
void Update ();
Parameters
Returns
void
void connect (std::string username, std::string authData);
Parameters
username - Username of the player
authData - custom data for validation by the zone adaptor on the server
Returns
void
void disconnect ();
Parameters
Returns
void
void initUDP();
Parameters
Returns
void
void join Lobby ();
Parameters
Returns
void
void leave Lobby ();
Parameters
Returns
void
void subscribe Lobby ();
Parameters
Returns
void
void unsubscribe Lobby ();
Parameters
Returns
void
void join Room ( std :: string roomId );
Parameters
roomId - Id of the room to be joined
Returns
void
void join Room With NUser ( int userCount );
Parameters
userCount- number of users in room to be joined
Returns
void
void joinRoomInUserRange ( int minJoinedUsers , int maxJoinedUsers , bool maxPreferred );
Parameters
userCount- number of users in room to be joined
Returns
void
void joinRoomWithProperties( std :: map < std :: string , std :: string > tableProperties );
Parameters
tableProperties- properties of the room to be joined
Returns
void
void leaveRoom ( std :: string roomId );
Parameters
roomId - Id of the room to be left
Returns
void
void createRoom ( std :: string name , std :: string owner , int maxUsers , std :: map < std :: string , std :: string > tableProperties );
Parameters
name - name of the room owner - administrator of the room maxUsers - number of maximum users allowed in the room tableProperties - properties of room for matchmaking ( pass null if not required )
Returns
void
void deleteRoom ( std :: tring roomId );
Parameters
roomId - Id of the room to be deleted
Returns
void
void subscribeRoom ( std :: string roomId );
Parameters
roomId - Id of the room to be subscribed
Returns
'void'
void unsubscribeRoom ( std :: string roomId );
Parameters
roomId - Id of the room to be subscribed
Returns
void
void sendChat ( std :: string message );
Parameters
message - message to be send
Returns
void
void sendPrivateChat ( std :: string toUser , std :: string message )
Sends a private message to the given user if its online. Result of the request is provided in the onSendPrivateChatDone callback of the registered ChatRequestListener objects. The sender and receiver don't need to be in the same room or lobby for the private message to be delivered. This is useful in building invite/challenge friend like scenarios. If successful, the receiver will get a onPrivateChatReceived event on its registered NotifyListener objects.
Parameters
toUser - the recipient of the private chat
message - message to be send
Returns
void
void sendUpdate ( byte * update , int updateLength );
Parameters
update - binary data to be send
Returns
void
void getLiveRoomInfo ( std :: string roomId );
Parameters
roomId - Id of the room
Returns
void
void getLiveUserInfo ( std :: string username );
Parameters
username - user who's information is requested
Returns
void
void getLiveLobbyInfo ();
Parameters
Returns
void
void setCustomUserData ( std :: string userName , std :: string customData );
Parameters
userName - user for whom custom data has to be update customData - custom data that will be set for the user
Returns
void
Updates the custom data associated with the given room on the server. The result is provided in the onSetCustomRoomDataDone callback of the registered RoomRequestListener objects. It is recommended you use the room's properties where ever possible. Use this when you need to associate data with a room which can not be represented as key value pairs.
void SetCustomRoomData ( std :: string roomId , std :: string customRoomData )
Parameters
roomId - Id of the room customRoomData - custom data that will be set for the room
Returns
void
void updateRoomProperties ( std :: string roomID , std :: map < std :: string , std :: string > tableProperties , std :: vector < std :: string > removeArray );
Parameters
roomId - Id of the room tableProperties - properties that will be set for the room removeArray - properties that will be removed for the room
Returns
void
void lockProperties ( std :: map < std :: string , std :: string > properties );
Lock the properties associated with the joined room on the server for requested user. Result is provided in the onLockPropertyDone callback of the registered RoomRequestListener objects. Lock properties will fail if any other user has lock on same property, otherwise property will be added in lockTable with owner name. This request (if successful) will also result in an onUserChangeRoomProperty notification on the registered NotifyListener objects to be triggered for all subscribed users of the room.
Parameters
properties - properties and their values to be locked
Returns
void
void unlockProperties ( std :: vector < std :: string > properties );
Unlock the properties associated with the joined room on the server for requested user. Result is provided in the onUnlockPropertyDone callback of the registered RoomRequestListener objects. Unlock properties will fail if any other user has lock on same property, otherwise property will be removed from lock table. This request (if successful) will also result in an onUserChangeRoomProperty notification on the registered NotifyListener objects to be triggered for all subscribed users of the room.
Parameters
properties - vector of properties to be unlocked
Returns
void
void getOnlineUsers ();
Parameters
Returns
void
void getAllRooms ();
Parameters
Returns
void
void getRoomWithNUser ( int userCount );
Parameters
userCount- number of users in room to be joined
Returns
void
void getRoomsInUserRange ( int minJoinedUsers , int maxJoinedUsers );
Parameters
minJoinedUsers- minimum number of users in room to be joined
maxJoinedUsers- maximum number of users in room to be joined
Returns
void
void getRoomWithProperties ( std :: map < std :: string , std :: string > properties );
Parameters
properties- properties of the room to be joined
Returns
void
void setZoneRequestListener ( ZoneRequestListener * listener );
Parameters
listener - method for listening to the request
Returns
void
void setRoomRequestListener ( RoomRequestListener * listener );
Parameters
listener - method for listening to the request
Returns
void
void setLobbyRequestListener ( LobbyRequestListener * listener );
Parameters
listener - method for listening to the request
Returns
void
public void setNotificationListener ( NotifyListener * listener );
Parameters
listener - method for listening to the request
Returns
void
void addConnectionRequestListener ( ConnectionRequestListener * listener )
Parameters
listener - method for listening to the request
Returns
void
Registers the given listener object to the list of objects on which callbacks will be invoked when a response from the server is received for a SendUpdatePeers request. The object must implement the UpdateRequestListener interface.
void AddUpdateRequestListener ( UpdateRequestListener * listener )
Parameters
listener - listener object
Returns
void
Registers the given listener object to the list of objects on which callbacks will be invoked when a response from the server is received for a SendChat request. The object must implement the ChatRequestListener interface.
public void AddChatRequestListener ( ChatRequestListener * listener )
Parameters
listener - listener object
Returns
void
Sends a start game request to the server. Result of the request is provided in the onGameStarted callback of the TurnBasedRoomListener.
startGame ( )
Returns
void
Sends a stop game request to the server. Result of the request is provided in the onGameStopped callback of the TurnBasedRoomListener.
stopGame ( )
Returns
void
Sends a get move history request to the server. Result of the request is provided in the onGetMoveHistoryDone callback of the TurnBasedRoomListener.
getMoveHistory ( )
Returns
void
Sends a create turn based room request to the server with the given meta data. Result of the request is provided in the onCreateRoomDone callback of the registered ZoneRequestListener objects. If successful, this will create a dynamic turn based room at the server. These rooms lifetime is limited till the time users are inside it. Read more about Rooms here.
public void createTurnRoom ( String name , String owner , int maxUsers , std::map < std::string , std::string > tableProperties , int turnTime )
Parameters
name - name of the room owner - owner of the room ( behavior and usage of this meta property is up to the developer ) maxUsers - number of maximum users allowed in the room tableProperties - properties of room ( can be null ) turnTime - the time ( in seconds ) allowed for a user to complete its turn and send a move .
Returns
void
Sends a move to the server for the joined turn based room.Result of the request is provided in the onSendMoveDone callback of the registered TurnBasedRoomListener objects. If the joined user is not a turn based room or if its not the users turn, this request will fail. If successful, this will result in onMoveCompleted notification for all the subscribed users on the registered NotifyListener objects.
public void sendMove ( std::string moveData )
Parameters
moveData - any meta data associated with the move
Returns
void
public void setRecoveryAllowance ( int maxRecoveryTime )
Parameters
maxRecoveryTime - time - the time (in seconds) allowed to the client to recover from intermittent connection loss
Returns
void
public void recoverConnection ( )
Parameters
Returns
void