Removes a buddy from the current user's buddies list.

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

Syntax

C#
public class RemoveBuddyRequest : BaseRequest

Remarks

In order to remove a buddy, the current user must be online in the Buddy List system. If the buddy is removed successfully, the operation is confirmed by a BUDDY_REMOVE event; otherwise the BUDDY_ERROR event is fired.

This request can be sent if the Buddy List system was previously initialized only (see the InitBuddyListRequest request description).

Examples

The following example sends a request to remove a buddy:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSBuddyEvent.BUDDY_REMOVE, OnBuddyRemoved);
    sfs.AddEventListener(SFSBuddyEvent.BUDDY_ERROR, OnBuddyError);
    // Remove Jack from my buddies list
    sfs.Send(new RemoveBuddyRequest("Jack"));
}
void OnBuddyRemoved(BaseEvent evt) {
    Console.WriteLine("This buddy was removed: " + (Buddy)evt.Params["buddy"]);                         // .Net / Unity
    System.Diagnostics.Debug.WriteLine("This buddy was removed: " + (Buddy)evt.Params["buddy"]);        // Windows Universal
}
void OnBuddyError(BaseEvent evt) {
    Console.WriteLine("The following error occurred while executing a buddy-related request: " + (string)evt.Params["errorMessage"]);                           // .Net / Unity
    System.Diagnostics.Debug.WriteLine("The following error occurred while executing a buddy-related request: " + (string)evt.Params["errorMessage"]);          // Windows Universal
}

Inheritance Hierarchy

System..::..Object
  BaseRequest
    Sfs2X.Requests.Buddylist..::..RemoveBuddyRequest

See Also