Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Flash / ActionScript client for Stomp

UPDATE: an update to the STOMP AS3 client that works with latest versions of ActionScript 3 and Flex is now available.  The new client implements most (if not all) of the STOMP protocol.  You can download the binary and the source here.  A couple tutorials on how to use this client with ActiveMQ (and ActiveMessaging) are availabe here.


This page describes the Flash client for Stomp.

To get the source, refer to "Developer SVN access" and check out the source anonymously.

 This client package needs ActionScript 3. From a users perspective that means Flash Player 9.x (which most of us have these days), from a developers perspective that means:

  • Flash 9 Developer Alpha (the full release due April 2007) (Commercial)
  • Flex 2 Builder (Commercial)
  • Flex 2 SDK (Free here)

 There is nothing clever going on with this client - since the inclusion of Socket classes inside AS (and later, the XMLSocket which this package uses), Server to Client push with Flash has been easy.

 To set up the connection and subscriptions:

Code Block
public var socket:STOMPClient = new STOMPClient();	//Create the STOMP Client
socket.connect( "localhost", 61613 ); //Connect
socket.subscribe( new Subscription("/queue/myfirstq") ); 	//Subscribe to a queue
socket.subscribe( new Subscription("/topic/myfirsttopic") ); 	 //and a Topic


 To handle the messages within your code:

Code Block
myClassThatRecievesTheEvent.addEventListener(STOMPEvent.SubscribedEvent, myHandlerFunction);

function myHandlerFunction(evt:STOMPEvent):void {
    trace("Recieved:"+evt);
}