Packagecom.electrotank.electroserver5.api
Classpublic class PublicMessageRequest
InheritancePublicMessageRequest Inheritance EsRequest Inheritance EsMessage Inheritance flash.events.Event

This class is used to send a public message to a room that the user is in. A public message can contain a chat message and an optional EsObject. To send a public message to a room you must specify the room id and zone id. Public messages can be captured by a server-side event handler and modified or stopped. If the room has language filters enabled then the filter will be applied to the message. This shows how to send a simple public message to a room with no EsObject attached.
private var _es:ElectroServer;
private var _room:Room;
private function initialize():void {
        _es.engine.addEventListener(MessageType.PublicMessageEvent.name, onPublicMessageEvent);
}
private function sendTestMessage():void {
        //create the message object
        var pmr:PublicMessageRequest = new PublicMessageRequest();
        //configure it
        pmr.message = "Hello World!";
        pmr.roomId = _room.id;
        pmr.zoneId = _room.zoneId;
        //send it
        _es.engine.send(pmr);
}
This shows how to send a public message to a room with an EsObject attached.
private var _es:ElectroServer;
private var _room:Room;
private function initialize():void {
        _es.engine.addEventListener(MessageType.PublicMessageEvent.name, onPublicMessageEvent);
}
private function sendTestMessage():void {
        //create the message object
        var pmr:PublicMessageRequest = new PublicMessageRequest();
        //configure it
        pmr.message = "Hello World!";
        pmr.roomId = _room.id;
        pmr.zoneId = _room.zoneId;
        //create an EsObject to send
        var esob:EsObject = new EsObject();
        esob.setBoolean("playAudioWithMessage", true);
        //put it on the message
        pmr.esObject = esob;
        //send it
        _es.engine.send(pmr);
}
private function onPublicMessageEvent(e:PublicMessageEvent):void {
        trace(e.userName + " says '" + e.message + "'");
        trace("playAudioWithMessage: " + e.esObject.getBoolean("playAudioWithMessage").toString());
}



Public Properties
 PropertyDefined By
  esObject : EsObject
An optional EsObject to send with the message.
PublicMessageRequest
  message : String
The message to send.
PublicMessageRequest
 InheritedmessageNumber : int
EsMessage
 InheritedmessageType : MessageType
EsMessage
 InheritedrequestId : int
EsMessage
  roomId : int
The id of the target room for the message
PublicMessageRequest
 InheritedserverId : String
EsMessage
  zoneId : int
Id of the zone that contains the room
PublicMessageRequest
Public Methods
 MethodDefined By
  
PublicMessageRequest(m:MessageType = null, t:TBase = null)
PublicMessageRequest
  
fromThrift(t_:TBase):void
[override]
PublicMessageRequest
  
newThrift():TBase
[override]
PublicMessageRequest
  
toThrift():TBase
[override]
PublicMessageRequest
Property Detail
esObjectproperty
esObject:EsObject

An optional EsObject to send with the message.


Implementation
    public function get esObject():EsObject
    public function set esObject(value:EsObject):void
messageproperty 
message:String

The message to send.


Implementation
    public function get message():String
    public function set message(value:String):void
roomIdproperty 
roomId:int

The id of the target room for the message


Implementation
    public function get roomId():int
    public function set roomId(value:int):void
zoneIdproperty 
zoneId:int

Id of the zone that contains the room


Implementation
    public function get zoneId():int
    public function set zoneId(value:int):void
Constructor Detail
PublicMessageRequest()Constructor
public function PublicMessageRequest(m:MessageType = null, t:TBase = null)



Parameters
m:MessageType (default = null)
 
t:TBase (default = null)
Method Detail
fromThrift()method
override public function fromThrift(t_:TBase):void

Parameters

t_:TBase

newThrift()method 
override public function newThrift():TBase

Returns
TBase
toThrift()method 
override public function toThrift():TBase

Returns
TBase