com.electrotank.electroserver5.client.api
Class EsAggregatePluginRequest

java.lang.Object
  extended by com.electrotank.electroserver5.client.events.Event<EsMessageType>
      extended by com.electrotank.electroserver5.client.api.helper.EsMessage
          extended by com.electrotank.electroserver5.client.api.helper.EsRequest
              extended by com.electrotank.electroserver5.client.api.EsAggregatePluginRequest
All Implemented Interfaces:
ThriftSerializable

public class EsAggregatePluginRequest
extends EsRequest

Most games are event driven, and they communicate with the server when an important event happens on the client. If for your particular game events are happening extremely frequently, say, > 10 times per second, then it is smart to start aggregating your messages into fewer bigger messages. As a client developer you do not need to use this request object directly. The ESEngine class exposes an API that allows you to send these aggregates easily. What you do is tell the ESEngine that you want to start aggregating plugin messages and how frequently you want them sent (say, 200ms). Then you just send them using the API as frequently as you want, and they'll be queued and purged based on the frequency. Here is how you would tell the ESEngine class that you want to start sending aggregate messages. And then how you send them.

private var _es:ElectroServer;
private var _room:Room;

private function initialize():void {
        //send every 200ms
        _es.engine.startQueue(200);

        sendTestMessage();
}

private function sendTestMessage():void {
        //create the InvokePluginRequest object and configure it like you normally would
        var ipr:InvokePluginRequest = new InvokePluginRequest();
        ipr.roomId = _room.id;
        ipr.zoneId = _room.zoneId;
        ipr.parameters = new EsObject();
        ipr.parameters.setString("action", "shoot");
        ipr.parameters.setInteger("angle", 45);

        //Then send using this method instead of the send() method
        _es.engine.sendQueuedMessage(ipr);
}
 


Constructor Summary
EsAggregatePluginRequest()
           
EsAggregatePluginRequest(org.apache.thrift.TBase t)
           
 
Method Summary
 void fromThrift(org.apache.thrift.TBase t_)
           
 EsRequestDetails[] getPluginRequestArray()
          List of RequestDetails instances, each of which contain details on the plugin the message should go to.
 com.electrotank.electroserver5.thrift.ThriftAggregatePluginRequest newThrift()
           
 void setPluginRequestArray(EsRequestDetails[] v)
          List of RequestDetails instances, each of which contain details on the plugin the message should go to.
 com.electrotank.electroserver5.thrift.ThriftAggregatePluginRequest toThrift()
           
 
Methods inherited from class com.electrotank.electroserver5.client.api.helper.EsMessage
getMessageNumber, getMessageType, getRequestId, getServerId, setMessageNumber, setMessageType, setRequestId, setServerId
 
Methods inherited from class com.electrotank.electroserver5.client.events.Event
getType, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EsAggregatePluginRequest

public EsAggregatePluginRequest()

EsAggregatePluginRequest

public EsAggregatePluginRequest(org.apache.thrift.TBase t)
Method Detail

toThrift

public com.electrotank.electroserver5.thrift.ThriftAggregatePluginRequest toThrift()

newThrift

public com.electrotank.electroserver5.thrift.ThriftAggregatePluginRequest newThrift()

fromThrift

public void fromThrift(org.apache.thrift.TBase t_)

getPluginRequestArray

public EsRequestDetails[] getPluginRequestArray()
List of RequestDetails instances, each of which contain details on the plugin the message should go to.


setPluginRequestArray

public void setPluginRequestArray(EsRequestDetails[] v)
List of RequestDetails instances, each of which contain details on the plugin the message should go to.



Copyright © 2007-2010 Electrotank, Inc. All Rights Reserved.