Marmalade 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.

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).

AppWarp::Client::initialize("Your API Key", "Your Secret Key");

After initialization, it is recommended that you implement and set 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

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.

setZoneRequestListener : Set 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.

void setZoneRequestListener(ZoneRequestListener *listner);

setRoomRequestListener : Set 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

void setRoomRequestListener(RoomRequestListener *listener);

setLobbyRequestListener : Set 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.

void setLobbyRequestListener(LobbyRequestListener *listener);

setNotificationRequestListener : Set 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.

void setNotificationListener(NotificationListener *listener);

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