cocos2dx-client-event

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

Cocos2DX Client Event

All Rooms Event

This event is raised in response to the getAllRooms request. It is passed in the registered ZoneRequestListener’s onGetAllRoomsDone request. It exposes the following properties

  • int resultResult status of the request.
  • std::vector<std::string> list – room id array of all the rooms.
struct liveresult_struct { int result ; std :: vector < std :: string > list ; };
 typedef liveresult_struct liveresult ;
All Users Event

This event is raised in response to the getOnlineUsers request. It is passed in the registered ZoneRequestListener’s onGetOnlineUsersDone method. It exposes the following properties

  • int resultResult status of the request.
  • std::vector<std::string> list – array of usernames for all the online users.
struct liveresult_struct { int result ; std :: vector < std :: string > list ; };
 typedef liveresult_struct liveresult ;

Represents an array of usernames for all the online users if the request is successful.

Chat Event

This event is raised when a chat notification is received from a subscribed location such as room or lobby. It is passed in registered NotifyListener’s onChatReceived method. It exposes the following properties

  • std::string message – The string message sent by the sender.
  • std::string sender – The sender of the message.
  • std::string locationId – The id of the location in which the message was sent (eg: room id)
  • bool isLocationLobby – Is the location a room or lobby.
struct chat_struct { std :: string chat ; std :: string sender ; int locationId ; bool isLocationLobby ; int result ; };
 typedef chat_struct chat ;
Connect Event

This event is raised in response to a connect request. It is passed in the registered ConnectionRequestListener’s onConnectDone method. It exposes the following properties

  • int resultResult status of the request.
int result
Live Room Info Event

This event is raised in response to the getLiveRoomInfo or getLiveLobbyInfo request. It is passed in the registered RoomRequestListener’s onGetLiveRoomInfoDone method and in the LobbyRequestListener’s onGetLiveLobbyInfoDone method. It exposes the following properties

  • std::vector<std::string> users – Array of usernames who are joined in the room
  • std::string customData – Custom data associated with the room
  • std::map<std::string, std::string> properties – Properties associated with the room (empty for lobby).
  • room rm – The static information structure of the room (or lobby).
  • int resultResult status of the request.
struct liveroom_struct { room rm ; std :: string customData ; std :: vector < std :: string > users ; std :: map < std :: string , std :: string > properties ; int result ; };
 typedef liveroom_struct liveroom ;
Live User Info Event

This event is raised in response to the getLiveUserInfo request. It is passed in the registered ZoneRequestListener’s onGetLiverUserInfo request method. It exposes the following properties

  • int resultResult status of the request.
  • std::string locationId – The id of the location in which the user is present.
  • std::string name – The username of the user
  • std::string customData – The custom data associated with the user
struct liveuser_struct { std :: string name ; std :: string locationId ; std :: string customData ; int result ; };
 typedef liveuser_struct liveuser ;
Lobby Event

This event is raised in response to requests for join/leave/subscribe/unsubscribe lobby. It is passed in the corresponding methods of the registered LobbyRequestListener. It exposes the following properties.

  • std::string lobbyid – The id of the lobby. This is always 0 and is reserved for future if multi-lobby support is added.
  • std::string owner – The owner of the lobby.
  • int maxUsers – The max concurrent users allowed in the lobby.
  • std::string name – The name of the lobby.
  • bool isPrimary – Is the lobby the primary one. This is always true and is reserved for future if multi-lobby support is added.
  • int resultResult status of the request.
struct lobby_struct { std :: string lobbyid ; std :: string owner ; int maxUsers ; std :: string name ; bool isPrimary ; int result ; }; typedef lobby_struct lobby ;
Room Event

This event is raised in response to requests for join/leave/subscribe/unsubscribe room. It is passed in the corresponding methods of the registered RoomRequestListener. It exposes the following properties.

  • std::string roomId – Unique id of a room. It is unique across all the rooms.
  • std::string owner – owner of the room (behavior and usage of this meta property is up to the developer)
  • int maxUsers – number of maximum users allowed in the room
  • std::string name – name of the room
  • int resultResult status of the request.
struct room_struct { std :: string roomId ; std :: string owner ; int maxUsers ; std :: string name ; int result ; }; typedef room_struct room ;
Update Event

This event is raised when a updatePeers notification is received from a subscribed location such as room or lobby. It is passed in registered NotifyListener’s onUpdatePeersReceived method. It exposes the following properties

  • AppWarp::byte update[] – The byte array sent in the room.
  • int len – Lenght of the update array
AppWarp :: byte update [] int len
Matched Room Event

This event is raised in response to requests for matchmaking request(getRoomwithNUsers/getRoomWithProperties). It is passed in the corresponding methods of the registered ZoneRequestListener. It exposes the following properties.

  • int resultResult status of the request.
  • std::vector<room> roomData – Array RoomData objects representing each of the matched rooms.
struct matchedroom_struct { int result ; std :: vector < room > roomData ; };
 typedef matchedroom_struct matchedroom ;