Dispatched when a private chat message is received.


- message (String)
- the private message received.
- sender (User)
- the User object representing the user that sent the message; this property is undefined if the sender isn't in the same room of the recipient.
- roomId (Int32)
- the id of the room where the sender is.
- userId (Int32)
- the user id of the sender (useful in case of private messages across different rooms, when the sender object is not available).

History:
SmartFoxServer Pro v1.5.0 - roomId and userId parameters added.
Version:
SmartFoxServer Basic / Pro

The following example shows how to handle a private message.
CopyC#

SFSEvent.onPrivateMessage += OnPrivateMessage; smartFox.SendPrivateMessage("Hallo Jack!", 22); public void OnPrivateMessage(string message, User sender, int roomId, int userId) { Debug.WriteLine("User " + sender.GetName() + " sent the following private message: " + .message); }