Click or drag to resize

SFSBuddyVariable Class

The SFSBuddyVariable object represents a SmartFoxServer Buddy Variable entity on the client.
Inheritance Hierarchy
SystemObject
  Sfs2X.Entities.VariablesBaseVariable
    Sfs2X.Entities.VariablesSFSBuddyVariable

Namespace:  Sfs2X.Entities.Variables
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public class SFSBuddyVariable : BaseVariable, 
	BuddyVariable, Variable

The SFSBuddyVariable type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyIsOffline
Indicates whether the Buddy Variable is persistent or not.
Public propertyName
Indicates the name of this variable.
(Inherited from BaseVariable.)
Public propertyType
Indicates the type of this variable.
(Inherited from BaseVariable.)
Public propertyValue
Returns the untyped value of this variable.
(Inherited from BaseVariable.)
Top
Methods
  NameDescription
Public methodGetBoolValue
Retrieves the value of a boolean variable.
(Inherited from BaseVariable.)
Public methodGetDoubleValue
Retrieves the value of a double precision variable.
(Inherited from BaseVariable.)
Public methodGetIntValue
Retrieves the value of an integer variable.
(Inherited from BaseVariable.)
Public methodGetSFSArrayValue
Retrieves the value of a SFSArray variable.
(Inherited from BaseVariable.)
Public methodGetSFSObjectValue
Retrieves the value of a SFSObject variable.
(Inherited from BaseVariable.)
Public methodGetStringValue
Retrieves the value of a string variable.
(Inherited from BaseVariable.)
Public methodIsNull
Indicates if the variable is null.
(Inherited from BaseVariable.)
Public methodToString
Returns a string that contains the Buddy Variable name, type and value.
(Overrides ObjectToString.)
Top
Fields
  NameDescription
Public fieldStatic memberOFFLINE_PREFIX
The prefix to be added to a Buddy Variable name to make it persistent.
Top
Remarks
The Buddy Variable is a custom value attached to a Buddy object in a Buddy List that gets automatically synchronized between client and server on every change.

Buddy Variables work with the same principle of the User and Room Variables. The only difference is the logic by which they get propagated to other users. While Room and User Variables are usually broadcast to all clients in the same Room, Buddy Variables updates are sent to all users who have the owner of the Buddy Variable in their Buddy Lists.

Buddy Variables are particularly useful to store custom user data that must be "visible" to the buddies only, such as a profile, a score, a status message, etc. Buddy Variables can be set by means of the SetBuddyVariablesRequest request; they support the data types listed in the class (also nested). A Buddy Variable can also be null.

There is also a special convention that allows Buddy Variables to be set as "offline". Offline Buddy Variables are persistent values which are made available to all users who have the owner in their Buddy Lists, whether that Buddy is online or not. In order to make a Buddy Variable persistent, its name should start with a dollar sign ($). This conventional character is contained in the OFFLINE_PREFIX constant.

See Also