Subscribes the current user to Room-related events occurring in the specified Group.

Namespace: Sfs2X.Requests
Assembly: SmartFox2X (in SmartFox2X.dll) Version: (1.7.3)


public class SubscribeRoomGroupRequest : BaseRequest


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 ROOM_GROUP_SUBSCRIBE event; otherwise the ROOM_GROUP_SUBSCRIBE_ERROR event is fired.


The following example makes the current user subscribe a Group:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.ROOM_GROUP_SUBSCRIBE, OnSubscribeRoomGroup);
    sfs.AddEventListener(SFSEvent.ROOM_GROUP_SUBSCRIBE_ERROR, OnSubscribeRoomGroupError);
    // Subscribe the "card_games" group
    sfs.Send( new SubscribeRoomGroupRequest("card_games") );
void OnSubscribeRoomGroup(BaseEvent evt) {
    Console.WriteLine("Group subscribed. The following rooms are now accessible: " + (List<Room>)evt.Params["newRooms"]);                         // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Group subscribed. The following rooms are now accessible: " + (List<Room>)evt.Params["newRooms"]);        // Windows Universal
void OnSubscribeRoomGroupError(BaseEvent evt) {
    Console.WriteLine("Group subscription failed: " + (string)evt.Params["errorMessage"]);                          // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Group subscription failed: " + (string)evt.Params["errorMessage"]);         // Windows Universal

Inheritance Hierarchy


See Also