Sends an administrator message to a specific user or a group of users.

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

Syntax

C#
public class AdminMessageRequest : GenericMessageRequest

Remarks

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

Examples

The following example sends an administration message to all the users in the Zone; it also shows how to handle the related event:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.ADMIN_MESSAGE, OnAdminMessage);
    // Set the message recipients: all users in the Zone
    MessageRecipientMode recipMode = new MessageRecipientMode(MessageRecipientMode.TO_ZONE, null);
    // Send the administrator message
    sfs.Send( new AdminMessageRequest("Hello to everybody from the Administrator!", recipMode) );
}
void OnAdminMessage(BaseEvent evt) {
    Console.WriteLine("The administrator sent the following message: " + (string)evt.Params["message"]);                        // .Net / Unity
    System.Diagnostics.Debug.WriteLine("The administrator sent the following message: " + (string)evt.Params["message"]);       // Windows Universal
}

Inheritance Hierarchy

System..::..Object
  BaseRequest
    GenericMessageRequest
      Sfs2X.Requests..::..AdminMessageRequest

See Also