SmartFoxServer 2X C++ API
Sfs2X::Requests::SubscribeRoomGroupRequest Class Reference

Subscribe to the events of a Room Group More...

#include <SubscribeRoomGroupRequest.h>

Inherits Sfs2X::Requests::BaseRequest.

Public Member Functions

 SubscribeRoomGroupRequest (string groupId)
 Constructor More...
 

Detailed Description

Subscribe to the events of a Room Group

Constructor & Destructor Documentation

◆ SubscribeRoomGroupRequest()

Sfs2X::Requests::SubscribeRoomGroupRequest::SubscribeRoomGroupRequest ( string  groupId)

Constructor

Parameters
groupIdthe name of the group
ptrSmartFox->AddEventListener(SFSEvent::ROOM_GROUP_SUBSCRIBE, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnSubscribeRoomGroup, (unsigned long long)this));
ptrSmartFox->AddEventListener(SFSEvent::ROOM_GROUP_SUBSCRIBE_ERROR, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnSubscribeRoomGroupError, (unsigned long long)this));
boost::shared_ptr<IRequest> request (new SubscribeRoomGroupRequest("CardGames"));
ptrSmartFox->Send(request);
static void OnSubscribeRoomGroup(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
static void OnSubscribeRoomGroupError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
void CMyClass::OnSubscribeRoomGroup(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
CMyClass* ptrMyClass = (CMyClass*)ptrContext;
boost::shared_ptr<map<string, boost::shared_ptr<void>>> ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueRooms = (*ptrEventParams)["newRooms"];
boost::shared_ptr<vector<boost::shared_ptr<Room>>> ptrRooms = ((boost::static_pointer_cast<vectorboost::shared_ptr<Room>>>)(ptrEventParamValueRooms));
string* message = new string("Subscription done");
}
void CMyClass::OnSubscribeRoomGroupError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
CMyClass* ptrMyClass = (CMyClass*)ptrContext;
boost::shared_ptr<map<string, boost::shared_ptr<void>>> ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueErrorMessage = (*ptrEventParams)["errorMessage"];
boost::shared_ptr<string> ptrErrorMessage = ((boost::static_pointer_cast<string>))(ptrEventParamValueErrorMessage);
string* message = new string("Subscription failure: " + (*ptrErrorMessage));
}
See also
Core.SFSEvent.ROOM_GROUP_SUBSCRIBE, Core.SFSEvent.ROOM_GROUP_SUBSCRIBE_ERROR, UnsubscribeRoomGroupRequest