*We assure you that we do not spam. You may receive occasional emails from us.
 You can always unsubscribe.

J2ME Getting Started

WarpClient provides an interface for applications to interact with the cloud services. It allows client side applications to connect, subscribe and manage server side rooms, lobbies and users. The APIs are developed to be used asynchronously, which means you simply add the corresponding request listeners to the WarpClient instance to receive responses and updates. This page describes to how to set up your connection with the cloud server and introduces API usage.

Complete API Reference

In order to use the various functions available, you will have to initialize and connect the instance of WarpClient. WarpClient is initialized by passing the apiKey and secretKey which you received after creating an app from AppHq (App42 management console).

WarpClient.initialize("Your API Key", "Your Secret Key"); 

After initialization, it is recommended that you implement and add a request listeners which will be called by WarpClient with the result of the requests. WarpClient comprises different listeners for different type of requests namely

  • Connection Request Listener
  • Lobby Request Listener
  • Zone Request Listener
  • Room Request Listener
  • Notification Listener
WarpClient myGame = WarpClient.getInstance();  
myGame.addConnectionRequestListener(new MyConnectionListener());  

The connection request listener callback will be invoked once the connection with the Warp server has been established with the given username. If this is successful, you can go ahead and call the room/lobby APIs of your app zone. Note that two users can not be connected to the online application simultaneously. Here is a simple implementation of a request listener.

public class ConListen implements ConnectionRequestListener{
    public void onConnectDone(ConnectEvent event) {
        if(event.getResult() == WarpResponseResultCode.SUCCESS){            
			System.out.println("yipee I have connected");
    public void onDisconnectDone(ConnectEvent event) {
        System.out.println("On Disconnected invoked");
addZoneRequestListener : Add your listener object on which callbacks will be invoked when a response from the server is received for Zone level requests like create/deleteRoom, User requests etc.
public void addZoneRequestListener(ZoneRequestListener listener)

addRoomRequestListener : add your listener object on which callbacks will be invoked when a response from the server is received for Room requests like join/leaveRoom, subscribe/unsubscribeRoom and getLiveRoomInfo

public void addRoomRequestListener(RoomRequestListener listener)

addLobbyRequestListener : add your listener object on which callbacks will be invoked when a response from the server is received for Lobby requests like join/leaveLobby, subscribe/unsubscribeLobby and getLiveLobbyInfo.

public void addLobbyRequestListener(LobbyRequestListener listener)

addNotificationRequestListener : add your listener object on which callbacks will be invoked when a notification is received from the server for any resource that has been subscribed to.

public void addNotificationListener(NotifyListener listener)

Result Codes : These can be retrieved when an event callback is invoked from the event instance.

byte SUCCESS = 0;    
byte AUTH_ERROR = 1;    
byte RESOURCE_NOT_FOUND = 2;    
byte RESOURCE_MOVED = 3;     
byte BAD_REQUEST = 4;

Appwarp also allows you to set custom data for users and rooms through the methods setCustomUserData() and setCustomRoomData(). To retrieve the custom data and other information WarpClient comprises getLiveUserInfo() and getLiveRoomInfo() methods.