Package | com.smartfoxserver.v2.requests |
Class | public class AdminMessageRequest |
Inheritance | AdminMessageRequest com.smartfoxserver.v2.requests.GenericMessageRequest |
The current user must have administration 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 adminMessage event.
See also
Method | Defined By | ||
---|---|---|---|
Creates a new AdminMessageRequest instance. | AdminMessageRequest |
AdminMessageRequest | () | Constructor |
public function AdminMessageRequest(message:String, recipientMode:MessageRecipientMode, params:ISFSObject = null)
Creates a new AdminMessageRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
Parametersmessage:String — The message of the administrator 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
private function someMethod():void { sfs.addEventListener(SFSEvent.ADMIN_MESSAGE, onAdminMessage); // Set the message recipients: all users in the Zone var recipMode:MessageRecipientMode = new MessageRecipientMode(MessageRecipientMode.TO_ZONE, null); // Send the administrator message sfs.send(new AdminMessageRequest("Hello to everybody from the Administrator!", recipMode)); } private function onAdminMessage(evt:SFSEvent):void { trace("The administrator sent the following message: " + evt.params.message); }