sfs2x.client.requests
Class SubscribeRoomGroupRequest

java.lang.Object
  extended by sfs2x.client.requests.BaseRequest
      extended by sfs2x.client.requests.SubscribeRoomGroupRequest
All Implemented Interfaces:
sfs2x.client.requests.IRequest

public class SubscribeRoomGroupRequest
extends sfs2x.client.requests.BaseRequest

Subscribes the current user to Room-related events occurring in the specified Group. This allows the user to be notified of specific Room events even if he didn't join the Room from which the events originated, provided the Room belongs to the subscribed Group.

If the subscription operation is successful, the current user receives a roomGroupSubscribe event; otherwise the roomGroupSubscribeError event is fired.

Example
The following example makes the current user subscribe a Group:

private void someMethod() { sfs.addEventListener(SFSEvent.ROOM_GROUP_SUBSCRIBE, new IEventListener() { public void dispatch(BaseEvent evt) throws SFSException { System.out.println("Group subscribed. The following rooms are now accessible: " + evt.getArguments().get("newRooms")); } }); sfs.addEventListener(SFSEvent.ROOM_GROUP_SUBSCRIBE_ERROR, new IEventListener() { public void dispatch(BaseEvent evt) throws SFSException { System.out.println("Group subscription failed: " + evt.getArguments().get("errorMessage")); } }); // Subscribe the "cardGames" group sfs.send(new SubscribeRoomGroupRequest("cardGames")); }

See Also:
SFSEvent.ROOM_GROUP_SUBSCRIBE, SFSEvent.ROOM_GROUP_SUBSCRIBE_ERROR, UnsubscribeRoomGroupRequest

Field Summary
static java.lang.String KEY_GROUP_ID
          *Private*
static java.lang.String KEY_ROOM_LIST
          *Private*
 
Fields inherited from class sfs2x.client.requests.BaseRequest
AddBuddy, AdminMessage, AutoJoin, BanUser, BlockBuddy, CallExtension, ChangeRoomCapacity, ChangeRoomName, ChangeRoomPassword, CreateRoom, CreateSFSGame, FindRooms, FindUsers, GenericMessage, GetRoomList, GoOnline, Handshake, InitBuddyList, InvitationReply, InviteUser, JoinRoom, KEY_ERROR_CODE, KEY_ERROR_PARAMS, KickUser, LeaveRoom, Login, Logout, ManualDisconnection, ModeratorMessage, ObjectMessage, PingPong, PlayerToSpectator, PrivateMessage, PublicMessage, QuickJoinGame, RemoveBuddy, SetBuddyVariables, SetRoomVariables, SetUserVariables, SpectatorToPlayer, SubscribeRoomGroup, UnsubscribeRoomGroup
 
Constructor Summary
SubscribeRoomGroupRequest(java.lang.String groupId)
          Creates a new SubscribeRoomGroupRequest instance.
 
Method Summary
 void execute(SmartFox sfs)
          *Private*
 void validate(SmartFox sfs)
          *Private*
 
Methods inherited from class sfs2x.client.requests.BaseRequest
getId, getMessage, getTargetController, isEncrypted, setEncrypted, setId, setTargetController
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_GROUP_ID

public static final java.lang.String KEY_GROUP_ID
*Private*

See Also:
Constant Field Values

KEY_ROOM_LIST

public static final java.lang.String KEY_ROOM_LIST
*Private*

See Also:
Constant Field Values
Constructor Detail

SubscribeRoomGroupRequest

public SubscribeRoomGroupRequest(java.lang.String groupId)
Creates a new SubscribeRoomGroupRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters:
groupId - The name of the Room Group to subscribe.
See Also:
SmartFox.send(sfs2x.client.requests.IRequest), Room.getGroupId()
Method Detail

validate

public void validate(SmartFox sfs)
              throws sfs2x.client.exceptions.SFSValidationException
*Private*

Throws:
sfs2x.client.exceptions.SFSValidationException

execute

public void execute(SmartFox sfs)
*Private*