|
ElectroServer 5 Client: Cocoa-Touch
|
Most games are event driven, and they communicate with the server when an important event happens on the client. More...
Instance Methods | |
| (id) | - init |
| (id) | - initWithThriftObject: |
| (void) | - fromThrift: |
| (ThriftAggregatePluginRequest *) | - toThrift |
| (id) | - newThrift |
Properties | |
| NSMutableArray * | pluginRequestArray |
| List of RequestDetails instances, each of which contain details on the plugin the message should go to. More... | |
Additional Inherited Members |
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);
}
| - (void) fromThrift: | (id) | thriftObject |
Reimplemented from EsMessage.
| - (id) init |
| - (id) initWithThriftObject: | (id) | thriftObject |
| - (id) newThrift |
Reimplemented from EsMessage.
| - (ThriftAggregatePluginRequest *) toThrift |
Reimplemented from EsMessage.
|
readwritenonatomicretain |
List of RequestDetails instances, each of which contain details on the plugin the message should go to.