Sends a moderator message to a specific user or a group of users.

Namespace: Sfs2X.Requests
Assembly: SmartFox2X (in SmartFox2X.dll) Version: (1.7.3)


public class ModeratorMessageRequest : GenericMessageRequest


The current user must have moderation privileges to be able to send the message (see the User.PrivilegeId property).

The recipientMode parameter in the class constructor is used to determine the message recipients: a single user or all the users in a Room, a Group or the entire Zone. Upon message delivery, the clients of the recipient users dispatch the MODERATOR_MESSAGE event.


The following example sends a moderator message to all the users in the last joned Room; it also shows how to handle the related event:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.MODERATOR_MESSAGE, OnModeratorMessage);
    // Set the message recipients: all users in the current Room
    MessageRecipientMode recipMode = new MessageRecipientMode(MessageRecipientMode.TO_ROOM, sfs.LastJoinedRoom);
    // Send the moderator message
    sfs.Send( new ModeratorMessageRequest("Hello everybody, I'm the Moderator!", recipMode) );
void OnModeratorMessage(BaseEvent evt) {
    Console.WriteLine("The moderator sent the following message: " + (string)evt.Params["message"]);                        // .Net / Unity
    System.Diagnostics.Debug.WriteLine("The moderator sent the following message: " + (string)evt.Params["message"]);       // Windows Universal

Inheritance Hierarchy


See Also