HTML5 Client APIs
- initialize
- getInstance
- connect
- disconnect
- joinLobby
- leaveLobby
- subscribeLobby
- unsubscribeLobby
- joinRoom
- joinRoomInRange
- leaveRoom
- createRoom
- deleteRoom
AppWarp.WarpClient.initialize(apiKey, s2Address);
Parameters
appKey - The Application key of the zone its created from the admin dashboard. s2Address - The IP address of the server where the AppWarp S2 zone is hosted.
Returns
void
AppWarp.WarpClient.getInstance();
Returns
WarpClient
connect(username, authData);
Parameters
username - Username of the player
authData - custom data for validation by the zone adaptor on the server
Returns
void
disconnect();
Parameters
Returns
void
joinLobby();
Parameters
Returns
void
leaveLobby();
Parameters
Returns
void
subscribeLobby();
Parameters
Returns
void
unsubscribeLobby();
Parameters
Returns
void
joinRoom(roomId);
Parameters
roomId - Id of the room to be joined
Returns
void
joinRoomInRange(minJoinedUsers, maxJoinedUsers, maxPreferred);
Parameters
userCount- number of users in room to be joined
Returns
void
joinRoomWithProperties(tableProperties);
Parameters
tableProperties- properties of the room to be joined
Returns
void
leaveRoom(roomId);
Parameters
roomId - Id of the room to be left
Returns
void
createRoom(name, owner, maxUsers, 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
deleteRoom(roomId);
Parameters
roomId - Id of the room to be deleted
Returns
void
subscribeRoom(roomId);
Parameters
roomId - Id of the room to be subscribed
Returns
‘void’
unsubscribeRoom(roomId);
Parameters
roomId - Id of the room to be subscribed
Returns
void
sendChat(message);
Parameters
message - message to be send
Returns
void
sendPrivateChat(toUser, message)
Parameters
toUser - the recipient of the private chat
message - message to be send
Returns
void
sendUpdate(update);
Parameters
update - binary data to be send
Returns
void
getLiveRoomInfo(roomId);
Parameters
roomId - Id of the room
Returns
void
getLiveUserInfo(username);
Parameters
username - user who's information is requested
Returns
void
getLiveLobbyInfo();
Parameters
Returns
void
WarpClient.setCustomUserData(userName, customData);
Parameters
userName - user for whom custom data has to be update customData - custom data that will be set for the user
Returns
void
SetCustomRoomData(roomId, customRoomData)
Parameters
roomId - Id of the room customRoomData - custom data that will be set for the room
Returns
void
updateRoomProperties(roomID, tableProperties, 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
lockProperties(properties);
Parameters
properties - properties and their values to be locked
Returns
void
unlockProperties(properties);
Parameters
properties - vector of properties to be unlocked
Returns
void
getOnlineUsers();
Parameters
Returns
void
getAllRooms();
Parameters
Returns
void
getRoomsInRange(minJoinedUsers, maxJoinedUsers);
Parameters
minJoinedUsers- minimum number of users in room to be joined
maxJoinedUsers- maximum number of users in room to be joined
Returns
void
getRoomWithProperties(properties);
Parameters
properties- properties of the room to be joined
Returns
void
setResponseListener(event, callback);
Parameters
event - Event to be registered
callback - Callback Function
Returns
void
setNotifyListener(event, callback);
Parameters
event - Event to be registered
callback - Callback Function
Returns
void
resetNotifyListener(event);
Parameters
event - Event to be registered
callback - Callback Function
Returns
void
resetResponseListener(event);
Parameters
event - Event to be registered
callback - Callback Function
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. 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.
createTurnRoom (name ,owner , maxUsers , tableProperties , 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. 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 event.
sendMove (moveData )
Parameters
moveData - any meta data associated with the move
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