2

I am using ZendAMP php and Flex (Flash Builder 4). It works great, but I noticed when I am looking at the traffic going between my flex application and ZendAMF, there packets moving even though I am not requesting communications in my code.

For example, this is what my service looks like in flex:

var activityLogService:RemoteObject = new RemoteObject("zend");
activityLogService.showBusyCursor=true;
activityLogService.endpoint="http://myserver:80/amf/";
activityLogService.source="ActivityLogService";

Then I call something like activityLogService.getRecord(myPassedParams) after setting up my addlistener.

When I watch the network traffic using something such as fiddler, I can see my request and the response come back.

However, I also see these request packets that do not contain names of my zend service objects:

�����null�/1����
���
�Mflex.messaging.messages.CommandMessageoperationcorrelationIdmessageIdtimeToLivetimestampdestinationheaders    bodyclientIdI3961D727-35B9-F41C-713A-AA42625FCFD9��

%DSMessagingVersion DSIdnil

The response coming back is pretty vague too:

�����
/1/onResult������
�Uflex.messaging.messages.AcknowledgeMessagecorrelationIdclientIddestinationmessageIdtimestamptimeToLiveheaders bodyI3961D727-35B9-F41C-713A-AA42625FCFD9I53D9441D-E1DC-4829-9B3F-000040DA9368I1322EAF2-B588-9929-0AC4-000013A22D80131282149600�

Are these just some kind of 'keep alive' messages?

If so, is there a way to turn them off?

Also, if so, is there a way I can use them to keep some kind of session alive on the server side maybe (maybe that's what they are for)?

Scott Szretter
  • 3,938
  • 11
  • 57
  • 76
  • How are you watching the requests? Are you sure that all the requests are coming from your Flex app and targeting your server? For example if I have serviceCapture and tweetdeck up I see tons of traffic completely unrelated to any Flex app I may be running. – JeffryHouser Aug 08 '11 at 16:51
  • Using a program called fiddler2. I know it's from the app because in fiddler it shows the http url and that the path is the /amf/, just like normal requests I send. I noticed too that it looks like it sends a couple of these packets before I send my request. Again, almost like it's some kind of session or handshaking. – Scott Szretter Aug 08 '11 at 19:25
  • This is unusual to me; but I don't know exactly what is going on. I have not come across this in my own development. – JeffryHouser Aug 08 '11 at 19:37
  • You sure you don't have polling setup or something? – J_A_X Aug 09 '11 at 01:45
  • It looks like it may have been a polling component. – Scott Szretter Aug 15 '11 at 20:13
  • Update: I am polling every 10 seconds, but what I am seeing is for every poll (and other remote object requests), that small packet (in my post above) is transmitted first, flex waits for the response, then transmits another packet with the actual service request (and response comes back). – Scott Szretter Mar 03 '13 at 15:20

1 Answers1

0

The RemoteObject AMF implementation requires that the server-side implementations are stateful. This is defined as part of the protocol, so it shouldn't matter which back-end you;re talking to (ie., my experience is in BlazeDS, LCDS and WebOrb, but it should be the same with PHP)

When your application makes it's first AMF call to a RemoteObject, it checks to see if the client has a DSid value set. This is essentially a unique ID which identifies the flex client to the server.

If not, then a call is issued to get a new DSid, and all outbound calls are suspended until that call returns. From then on, the DSid is passed on all outbound calls in the header of the AMF packet.

If you ever reset the DSid on the client, (by calling FlexClient.getInstance().id = 'nil') this process will repeat. (ie., all calls will be suspended again until the server has issued a new DSid to the client.)

Basically, these are internal messages required for the AMF Protocol to work

Marty Pitt
  • 28,822
  • 36
  • 122
  • 195
  • I am re-visiting this, because I am getting two calls for seemingly EVERY request! I see that small request every time with the DSId nill. On the next (actual) request, it still shows the DSId nill, but also has "DSEndpoint zend" in it. It works fine, but it slows things down quite a bit. I am positive I am not doing that getInstance set to nil, so is there another way I could be wiping out the dsid, or something I need to do to make sure it is set and saved? – Scott Szretter Mar 03 '13 at 13:00