Flash Client APIs
- initialize
- getInstance
- connect
- disconnect
- joinLobby
- leaveLobby
- subscribeLobby
- unsubscribeLobby
- joinRoom
- joinRoomInRange
- joinRoomWithProperties
- leaveRoom
- initUDP
- recoverConnection
- setRecoveryAllowance
- getConnectionState
- enableTrace
- sendPrivateChat
- setNextTurn
- createRoom
- createTurnRoom
- deleteRoom
- subscribeRoom
- unsubscribeRoom
- sendChat
- sendUpdate
- sendUdpUpdate
- getLiveRoomInfo
- getLiveUserInfo
- getLiveLobbyInfo
- setCustomUserData
- setCustomRoomData
- updateRoomProperties
- setGeoLocation
- getSessionID
- lockRoomProperties
- sendPrivateUpdate
- getOnlineUsers
- getAllRooms
- getRoomInRange
- getRoomWithProperties
- setZoneRequestListener
- setRoomRequestListener
- setLobbyRequestListener
- setNotificationListener
- setConnectionRequestListener
- setUpdateRequestListener
- setChatRequestListener
- setTurnBasedRoomRequestListener
- sendMove
- startGame
- stopGame
- getMoveHistory
- recoverConnectionWithSessionID
- unlockRoomProperties
- sendPrivateUDPUpdate
public static function initialize(apiKey:String, secretKey:String):void;
Parameters
apiKey - The Application key given when the application was created. secretKey - The secret key corresponding to the application key given when the application was created.
Returns
void
public static function getInstance():WarpClient
Parameters
Returns
void
public function connect(username:String):void;
Parameters
username - Username of the player
Returns
void
public function disconnect():void;
Parameters
Returns
void
public function joinLobby():void;
Parameters
Returns
void
public function leaveLobby():void;
Parameters
Returns
void
public function subscribeLobby():void;
Parameters
Returns
void
public function unsubscribeLobby():void;
Parameters
Returns
void
public function joinRoom(roomId:String):void;
Parameters
roomId - Id of the room to be joined
Returns
void
public function joinRoomInRange(minUsers:int, maxUsers:int, maxPreferred:Boolean):void
Parameters
minUsers- number of minimum users in room to be joined
maxUsers- number of maximum users in room to be joined
maxPreferred- flag to specify search priority for room to be joined
Returns
void
public function joinRoomWithProperties(tableProperties:Object):void;
Parameters
tableProperties- properties of the room to be joined
Returns
void
public function leaveRoom(roomId:String):void;
Parameters
roomId - Id of the room to be left
Returns
void
public function initUDP():void;
Parameters
Returns
void
public static function setrecoveryallowance(time:int):void;
Parameters
time - the time (in seconds) allowed to the client to recover from intermittent connection loss
Returns
void
public function recoverConnection():void;
Parameters
Returns
void
public function createRoom(name:String, owner:String, maxUsers:int, tableProperties:Object):void;
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
public function createTurnRoom(name:String, owner:String, maxUsers:int, tableProperties:Object, turnTime:int):void;
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) turnTime - the time (seconds) given for each turn
Returns
void
public function deleteRoom(roomId:String):void;
Parameters
roomId - Id of the room to be deleted
Returns
void
public function subscribeRoom(roomId:String):void;
Parameters
roomId - Id of the room to be subscribed
Returns
‘void’
public function unsubscribeRoom(roomId:String):void;
Parameters
roomId - Id of the room to be subscribed
Returns
void
public function sendChat(message:String):void;
Parameters
message - message to be send
Returns
void
public function sendUpdate(update:ByteArray):void;
Parameters
update - binary data to be send
Returns
void
public function sendUdpUpdate(update:ByteArray):void;
Parameters
update - binary data to be send
Returns
void
public function getLiveRoomInfo(roomId:String):void;
Parameters
roomId - Id of the room
Returns
void
public function getLiveUserInfo(username:String):void;
Parameters
username - user who's information is requested
Returns
void
public function getLiveLobbyInfo():void;
Parameters
Returns
void
public function setCustomUserData(userName:String, customData:String):void;
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.
public function SetCustomRoomData(roomId:String, customRoomData:String):void;
Parameters
roomId - Id of the room customRoomData - custom data that will be set for the room
Returns
void
public function updateRoomProperties(roomID:String, tableProperties:Object, removeArray:Array);
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
public function getOnlineUsers():void;
Parameters
Returns
void
public function getAllRooms():void;
Parameters
Returns
void
public function getRoomsInRange(minUsers:int, maxUsers:int):void
Parameters
minUsers- number of minimun users in room to be joined
maxUsers- number of maximum users in room to be joined
Returns
void
public function getRoomWithProperties(properties:Object):void;
Parameters
properties- properties of the room to be joined
Returns
void
public function setZoneRequestListener(listener:ZoneRequestListener):void;
Parameters
listener - method for listening to the request
Returns
void
public function setRoomRequestListener(listener:RoomRequestListener):void;
Parameters
listener - method for listening to the request
Returns
void
public function setLobbyRequestListener(listener:LobbyRequestListener):void;
Parameters
listener - method for listening to the request
Returns
void
public function setNotificationListener(listener:NotificationListener):void;
Parameters
listener - method for listening to the request
Returns
void
public function setConnectionRequestListener(listener:ConnectionRequestListener):void;
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 SendUpdate request. The object must implement the UpdateRequestListener interface.
public function setUpdateRequestListener(listener:UpdateRequestListener):void;
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 function setChatRequestListener(listener:ChatRequestListener):void;
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 turn based room requests. The object must implement the TurnBasedRoomListener interface.
public function setTurnBasedRoomRequestListener(listener:TurnBasedRoomListener):void;
Parameters
listener - listener object
Returns
void
public function sendMove(moveData:String, nextTurn:String = ""):void
Parameters
moveData - data associated with the move to be sent
nextTurn - user to get next turn if isDefaultLogic was set false in startGame
Returns
void
public function startGame(isDefaultLogic:Boolean = true, firstTurn:String = ""):void
Parameters
isDefaultLogic - If default logic has to be followed
firstTurn - user to get first turn if isDefaultLogic is false
Returns
void
public function stopGame():void;
Parameters
Returns
void
public function getMoveHistory():void;
Parameters
Returns
void
setGeo allows you to connect to our cloud servers in locations other than the default location. This offers developers the choice to connect to the closest server depending on the client’s device location.
public static function setGeoLocation(location:String):void
Parameters
location - server location. For e.g. US, EU, JAPAN
Returns
void
getConnectionState allows you to get the current Connection State of WarpClient.
public function getConnectionState():int
Parameters
Returns
int
getSessionID returns the SessionID for current connection with AppWarp Server. SessionID is required when calling recoverConnectionWithSessionID.
public function getSessionID():int
Parameters
Returns
int
recoverConnectionWithSessionID allows you to recover a connection when you have session id from previous connection. Username is also required.
public function recoverConnectionWithSessionID(sessionID:int, username:String):void
Parameters
sessionID - session id of the connection to be recoverd
username - user to be recovered
Returns
void
enableTrace allows you to turn on traces. This is helpful in debugging.
public static function enableTrace(enable:Boolean):void
Parameters
enable - enable traces
Returns
void
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.
public function lockRoomProperties(lockProperties:Object):void
Parameters
lockProperties - properties to be locked
Returns
void
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.
public function unlockRoomProperties(properties:Array):void
Parameters
properties - properties to be unlocked
Returns
void
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.
public function sendPrivateChat(to:String, msg:String):void
Parameters
to - recipient of the message
msg - message to be sent
Returns
void
Sends a byte array update message to recipient user. Result of the request is provided in the onSendPrivateUpdateDone callback of the registered UpdateRequestListener objects. Remote user will get a onPrivateUpdateReceived event on their registered NotifyListener objects. This is useful if developers want to send private data between the users. The corresponding UDP flavor of this API is sendUDPPrivateUpdate, which is unreliable and may not work over cellular data connections – hence no result callback should be expected from it. The behavior is otherwise similar.
public function sendPrivateUpdate(to:String, msg:ByteArray):void
Parameters
to - recipient of the message
msg - message to be sent
Returns
void
Sends a byte array update message to the recipient user. This is useful if developers want to send private data between the users. It is unreliable and may not work over cellular data connections – hence no result callback should be expected from it. The corresponding flavor of this API is sendPrivateUpdate which shows a similar behavior.
public function sendUdpPrivateUpdate(to:String,msg:ByteArray):void
Parameters
to - recipient of the message
msg - message to be sent
Returns
void
When the onNextTurnRequest is sent by the server, it sends the next turn to the server for the joined turn based room.Result of the request is provided in the onSetNextTurnDone callback of the registered Turn Based Room Listener objects. If the joined user is not in turn based room or if it’s not the user’s turn, this request will fail. If successful, this will result in onMoveCompleted notification for all the subscribed users on the registered NotifyListener objects.
public function setNextTurn(nextTurn:String):void
Parameters
nextTurn - recipient of the message
Returns
void