serverPushEvents models or collections

3 views
Skip to first unread message

Larry Erickson

unread,
May 24, 2011, 3:11:17 AM5/24/11
to restfulx-framework
Been using the serverPush feature with juggernaut very successfully
for a while and so far have been pushing models and updating the cache
in flex as follows.

private function onFXMLServerPush(event:ServerPushEvent):void {
var unmarshalled:RxModel =
Rx.serializers.xml.unmarshall(event.message) as RxModel;
Rx.models.cache.update(unmarshalled, XMLHTTPServiceProvider.ID as
IServiceProvider);
}
Sometimes I make a change to one attribute of a model that has 500
records, and end up pushing 500 push messages, one for each record.
Wondering if it would be possible to push an array of models instead
of a model, and then I would only need to do one push message.

Trying something like the following which obviously does not work

private function
onFXMLServerPush(event:ServerPushEvent):void {
var unmarshalled:RxCollection=
Rx.serializers.xml.unmarshall(event.message) as RxCollection;
Rx.models.cache.update(unmarshalled, XMLHTTPServiceProvider.ID as
IServiceProvider);
}

I think to get this to work I would need to know the answer to the
following three questions, neither of which may be possible.

Can I update a model cache by passing it an array (modelcollection or
rxcollection). If so, how?
Does a serverPushEvent message have to be a model, or can it be a
collection?
If it can, how could I distinguish between a model message and a
collection message?


Thanks
Reply all
Reply to author
Forward
0 new messages