InitBuddyListRequest
Initializes the Buddy List system on the current client.
new InitBuddyListRequest()
Creates a new InitBuddyListRequest instance. The instance must be passed to the SmartFox.send() method for the request to be executed.
Buddy List system initialization involves loading any previously stored buddy-specific data from the server, such as the current user's buddy list, his previous state and the persistent Buddy Variables. The initialization request is the first operation to be executed in order to be able to use the Buddy List system features. Once the initialization is completed, the buddyListInit event id fired and the user has access to all his data set previously and he can start to interact with his buddies; if the initialization fails, a buddyError event is fired.
Example
This example initializes the Buddy List system.
function someMethod()
{
sfs.addEventListener(SFS2X.SFSBuddyEvent.BUDDY_LIST_INIT, onBuddyListInitialized, this);
sfs.addEventListener(SFS2X.SFSBuddyEvent.BUDDY_ERROR, onBuddyError, this)
// Initialize the Buddy List system
sfs.send(new SFS2X.InitBuddyListRequest());
}
function onBuddyListInitialized(evtParams)
{
console.log("Buddy List system initialized successfully");
// Retrieve my buddies list
var buddies = sfs.buddyManager.getBuddyList();
// Display the online buddies in a list component in the application interface
...
}
function onBuddyError(evtParams)
{
console.log("The following error occurred while executing a buddy-related request: " + evtParams.errorMessage);
}