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

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

Syntax

C#
public class UnsubscribeRoomGroupRequest : BaseRequest

Remarks

This allows the user to stop being notified of specific Room events occurring in Rooms belonging to the unsubscribed Group.

If the operation is successful, the current user receives a ROOM_GROUP_UNSUBSCRIBE event; otherwise the ROOM_GROUP_UNSUBSCRIBE_ERROR event is fired.

Examples

The following example makes the current user unsubscribe a Group:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.ROOM_GROUP_UNSUBSCRIBE, OnUnsubscribeRoomGroup);
    sfs.AddEventListener(SFSEvent.ROOM_GROUP_UNSUBSCRIBE_ERROR, OnUnsubscribeRoomGroupError);
    // Unsubscribe the "card_games" group
    sfs.Send( new UnsubscribeRoomGroupRequest("card_games") );
}
void OnUnsubscribeRoomGroup(BaseEvent evt) {
    Console.WriteLine("Group unsubscribed: " + (string)evt.Params["groupId"]);                          // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Group unsubscribed: " + (string)evt.Params["groupId"]);         // Windows Universal
}
void OnUnsubscribeRoomGroupError(BaseEvent evt) {
    Console.WriteLine("Group unsubscribing failed: " + (string)evt.Params["errorMessage"]);                         // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Group unsubscribing failed: " + (string)evt.Params["errorMessage"]);        // Windows Universal
}

Inheritance Hierarchy

System..::..Object
  BaseRequest
    Sfs2X.Requests..::..UnsubscribeRoomGroupRequest

See Also