new BlockBuddyRequest(buddyName, blocked)

Creates a new BlockBuddyRequest instance. The instance must be passed to the SmartFox.send() method for the request to be executed.

Blocked buddies won't be able to see if the user who blocked them is online in their buddy list; they also won't be able to send messages or requests to that user.

In order to block a buddy, the current user must be online in the Buddy List system. If the operation is successful, a buddyBlock confirmation event is dispatched; otherwise the buddyError event is fired.

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


This example handles the possible events caused by a request to block a buddy.

function someMethod()
	sfs.addEventListener(SFS2X.SFSBuddyEvent.BUDDY_BLOCK, onBuddyBlock, this);
	sfs.addEventListener(SFS2X.SFSBuddyEvent.BUDDY_ERROR, onBuddyError, this);

	// Block user "Jack" in my buddies list
	smartFox.send(new SFS2X.BlockBuddyRequest("Jack", true));

function onBuddyBlock(evtParams)
	var isBlocked = evtParams.buddy.isBlocked;
	console.log("Buddy " + + " is now " + (isBlocked ? "blocked" : "unblocked"));

function onBuddyError(evtParams)
	console.log("The following error occurred while executing a buddy-related request: " + evtParams.errorMessage);


Name Type Optional Description




The name of the buddy to be removed from the user's buddy list.




true if the buddy must be blocked; false if he must be unblocked.

See also