Adobe AIR/Flex Not Receiving Push

  • mulhern
Posted: Wed, 04/14/2010 - 05:09

I have the following test project and cannot get the server to push anything back to my Adobe AIR client. Here is my code:

SimpleListener.as

package
{
import com.exadel.flamingo.flex.components.flamingo.push.FlamingoListener;
import com.exadel.flamingo.flex.components.flamingo.push.FlamingoMessage;

import mx.controls.Alert;

public class SimpleListener implements FlamingoListener
{
public function onException(exception:Object):void
{
Alert.show(exception.toString(), "Exception");
}

public function onMessage(message:FlamingoMessage):void
{
trace(message.getPayloadData());
}
}
}

FlamingoTest.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
xmlns:client="com.exadel.flamingo.flex.components.flamingo.push.client.*"
creationComplete="init();"
showStatusBar="false">

<client:FxClientSideBroker id="broker" startOnCreate="false" />

<mx:Script>
<![CDATA[
import com.exadel.flamingo.flex.components.flamingo.push.EditableFlamingoMessage;
import com.exadel.flamingo.flex.components.flamingo.push.client.FxClientSideBroker;
import com.exadel.flamingo.flex.components.flamingo.push.FlamingoListener;
import com.exadel.flamingo.flex.components.flamingo.push.FlamingoObjectsFactory;
import com.exadel.flamingo.flex.components.flamingo.push.FlamingoDestination;
import com.exadel.flamingo.flex.components.flamingo.push.FlamingoPushConfiguration;

private static const SERVER_CONTEXT_URL:String = "http://myjbossserver/DataServices";

private function doPush():void
{

FlamingoPushConfiguration.server = FlamingoPushConfiguration.SERVER_SEAM;
FlamingoPushConfiguration.protocol = FlamingoPushConfiguration.PROTOCOL_HESSIAN;

broker.pollingServletURL = SERVER_CONTEXT_URL + "/poll";

var listener:SimpleListener = new SimpleListener();
var dest:String = "test";

var destination:FlamingoDestination = FlamingoObjectsFactory.createDestination(dest);
broker.subscribe(destination, listener);

broker.start();
}

private function init():void
{
doPush();
}
]]>
</mx:Script>

</mx:WindowedApplication>

I am using Flex SDK 3.2, AIR 1.5, Flamingo 2.1.0, am I missing anything to get this to work?

Thanks,

Craig

Just to add to this I am

  • mulhern
  • 04/14/10
  • Wed, 04/14/2010 - 06:49

Just to add to this I am seeing the GET requests but not the POST's as the debug output from Charles shows below:

http://myjbossserver/DataServices/poll?r=<id> 200 GET
...

I have seen how the output should look on a JavaFX client so do not understand what is wrong with the Flex version.

Thanks again,

Craig

Problem Identified...

  • mulhern
  • 04/14/10
  • Tue, 04/20/2010 - 06:21

Ok, so after downloading the Flamingo source and a bit of debugging I have found that the problem would appear to be with the Seam Destination URI.

When being run from AIR, the destination URI which is currently set in the following class will never resolve to a valid endpoint:

com.exadel.flamingo.flex.components.flamingo.push.client.TransportProvider.as

private static const DESTINATION_SEAM:String = "seam/resource/hessian";
..
..
dest = DESTINATION_SEAM + '/' + component;
..
..

The destination URI would need to be something more like:

private static const DESTINATION_SEAM:String = "http://myjbossserver/DataServices/seam/resource/hessian";

It would be good to get a response to this to make sure I've not missed anything fundamental, but this fix is now working and I'm successfully receiving messages pushed from the server.

Note: Obviously I'll need to modify the class to allow me to set a property to prefix the destination URI, rather than hard code the source.

Cheers,

Craig

Weight Loss indiscreetness

  • leroymil5
  • 02/16/11
  • Mon, 03/07/2011 - 08:46

Weight Loss indiscreetness Curvaceous auto insurance quotes faulkner talesmen