| Package | com.smartfoxserver.v2.requests |
| Class | public class SubscribeRoomGroupRequest |
| Inheritance | SubscribeRoomGroupRequest com.smartfoxserver.v2.requests.BaseRequest |
If the subscription operation is successful, the current user receives a roomGroupSubscribe event; otherwise the roomGroupSubscribeError event is fired.
See also
| Method | Defined By | ||
|---|---|---|---|
SubscribeRoomGroupRequest(groupId:String)
Creates a new SubscribeRoomGroupRequest instance. | SubscribeRoomGroupRequest | ||
| SubscribeRoomGroupRequest | () | Constructor |
public function SubscribeRoomGroupRequest(groupId:String)Creates a new SubscribeRoomGroupRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
ParametersgroupId:String — The name of the Room Group to subscribe.
|
See also
private function someMethod():void
{
sfs.addEventListener(SFSEvent.ROOM_GROUP_SUBSCRIBE, onGroupSubscribed);
sfs.addEventListener(SFSEvent.ROOM_GROUP_SUBSCRIBE_ERROR, onGroupSubscribeError);
// Subscribe the "cardGames" group
sfs.send(new SubscribeRoomGroupRequest("cardGames"));
}
private function onGroupSubscribed(evt:SFSEvent):void
{
trace("Group subscribed. The following rooms are now accessible: " + evt.params.newRooms);
}
private function onGroupSubscribeError(evt:SFSEvent):void
{
trace("Group subscription failed: " + evt.params.errorMessage);
}