28 April 2008
All
Two years ago, I wrote a simple Google Maps collaboration example. The Flex application listened to Google Maps events to synchronize maps between different users. It also added nice collaboration features such as videoconferencing and a collaborative whiteboard overlaid on top of the map. In addition to demonstrating the real-time messaging capabilities of Flex, this application also illustrated Flex/Ajax integration using External Interface.
Two recent events prompted me to revisit this sample:
So, I updated the sample to work with the Yahoo! Maps ActionScript API and BlazeDS (or LiveCycle Data Services). No need to communicate between Ajax and Flex in this version since the rendering of the map is entirely done within the Flex application.
Disclaimer: I'm currently hosting the application on the server I use to host this blog (basic PHP and Tomcat hosting plan). I don't know much about the characteristics of my server, but I'm probably sharing it with a few dozens of other domains and the resources allocated to me are obviously limited in that shared environment. This is clearly not the ideal environment to host a potentially large scale real time application and I'm investigating other hosting solutions. In the meantime, if you experience difficulties running the app, you can install it locally using the instructions provided below (in "Local installation instructions"). The hosted version tries to connect using RTMP by default (available only as part of LiveCycle Data Services) and falls back to "long AMF polling" or regular AMF polling if the RTMP connection fails.
Note: you can right-click the application and select View Source or click here to see the source code of the application.
Local installation instructions:
<channel-definition id="my-longpolling-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amflongpolling"
class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>true</polling-enabled>
<polling-interval-seconds>5</polling-interval-seconds>
<wait-interval-millis>60000</wait-interval-millis>
<client-wait-interval-millis>1</client-wait-interval-millis>
<max-waiting-poll-requests>200</max-waiting-poll-requests>
</properties>
</channel-definition>
<destination id="flexmaps">
<properties>
<server>
<allow-subtopics>true</allow-subtopics>
<subtopic-separator>.</subtopic-separator>
</server>
</properties>
<channels>
<channel ref="my-longpolling-amf"/>
<channel ref="my-polling-amf"/>
</channels>
</destination>
Make sure you configure your Flex Builder project to work with BlazeDS. To read instructions on how to set up a Flex Builder project that works with BlazeDS. Make sure your BlazeDS turnkey server is started, and click http://localhost:8400/samples/fb-project-setup.htm