Click or drag to resize


Dispatched when a message from a buddy is received by the current user.

Namespace:  Sfs2X.Core
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: (1.7.11)
public static readonly string BUDDY_MESSAGE

Field Value

Type: String
This event is fired in response to the BuddyMessageRequest request.

The same event is fired by the sender's client too, so that the user is aware that the message was delivered successfully to the recipient, and it can be displayed in the chat area keeping the correct message ordering. As in this case the value of the buddy parameter is null (because, being the sender, the user is not buddy to himself of course), there is no default way to know who the message was originally sent to. As this information can be useful in scenarios where the sender is chatting with more than one buddy at the same time in separate windows or tabs (and we need to write his own message in the proper one), the data parameter can be used to store, for example, the id of the recipient buddy.

The Params object contains the following parameters:

buddy(Buddy) The object representing the message sender. If the isItMe parameter is true, the value of this parameter is null (because a user is not buddy to himself).
isItMe(bool) true if the message sender is the current user himself (in this case this event is a sort of message delivery confirmation).
message(string) The message text.
data(ISFSObject) An object containing additional custom parameters (e.g. the message color, an emoticon id, etc).
See the BuddyMessageRequest example.
See Also