Packagecom.smartfoxserver.v2.requests
Classpublic class ModeratorMessageRequest
InheritanceModeratorMessageRequest Inheritance com.smartfoxserver.v2.requests.GenericMessageRequest

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

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 moderatorMessage event.

View the examples

See also

moderatorMessage event
User.privilegeId
AdminMessageRequest


Public Methods
 MethodDefined By
  
ModeratorMessageRequest(message:String, recipientMode:MessageRecipientMode, params:ISFSObject = null)
Creates a new ModeratorMessageRequest instance.
ModeratorMessageRequest
Constructor Detail
ModeratorMessageRequest()Constructor
public function ModeratorMessageRequest(message:String, recipientMode:MessageRecipientMode, params:ISFSObject = null)

Creates a new ModeratorMessageRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters
message:String — The message of the moderator to be sent to the target user/s defined by the recipientMode parameter.
 
recipientMode:MessageRecipientMode — An instance of MessageRecipientMode containing the target to which the message should be delivered.
 
params:ISFSObject (default = null) — An instance of SFSObject containing custom parameters to be sent to the recipient user/s.

See also

Examples
The following example sends a moderator message to all the users in the last joined Room; it also shows how to handle the related event:
     
     private function someMethod():void
     {
         sfs.addEventListener(SFSEvent.MODERATOR_MESSAGE, onModeratorMessage);
         
         // Set the message recipients: all users in the current Room
         var recipMode:MessageRecipientMode = new MessageRecipientMode(MessageRecipientMode.TO_ROOM, sfs.lastJoinedRoom);
         
         // Send the moderator message
         sfs.send(new ModeratorMessageRequest("Hello everybody, I'm the Moderator!", recipMode));
     }
     
     private function onModeratorMessage(evt:SFSEvent):void
     {
         trace("The moderator sent the following message: " + evt.params.message);
     }