Juggernaut for Flex

July 20th, 2007

Continuing on the ‘Juggernaut for …’ theme, I’ve created Juggernaut for Flex. It’s is basically a port of the flash version of Juggernaut, except you can attach listeners to connect events etc, and you can edit the channel, port and server information before connecting.

Received data is sent to JavaScript and evaluated (like the current Juggernaut version); so where’s the Flex integration? FABridge. You can execute functions and edit Flex components, you could even go as far as to build the whole Flex interface in RJS, and have it dynamically loaded! Below is a zip of the core FlexJuggernaut classes, and and example application.

Usage is thus:

Actionscript:

juggernaut = new FlexJuggernaut();
juggernaut.connect();

Views:

<%= listen_to_juggernaut_channels :chat_channel, ‘null’, {:swf_address => ‘/FlexJuggernautExample.swf’, :width => ‘100%’, :height => ‘100%’} %>

Then you can reference your Flex like this:

var flexApp = FABridge.juggernaut.root();

And call functions, or edit components (the log function is demonstrated in the example app):

flexApp.log(’foo’);

Flex Juggernaut - Core Flex Classes
Flex Juggernaut - Example Flex Application
Flex Juggernaut - Example Rails Application

I’ve also updated the core Juggernaut files so you can now specify the height and width of the swf (defaults to 1px), the Flash version (defaults to 8), and you can also specify the swf address (defauts to ‘/juggernaut.swf’). For those of you not following the Juggernaut Google Groups page, some other updates include:

- Add/remove channels
- Toggle base64 for messages (useful when having serialization issues)
- Console log to firebug
- Updated documentation
- Send messages to a particular user
- Auth requests (and fixed security issues, channels and unique id are
now sent too for checking)
- Log-off notification
- Automatically updates to required flash version (express install).
- Updated flash to 8, now uses External interface (no know more
fscommand and vbscript hackery)
- More helper options for escaping html etc
- Few more things I’ve forgotten ;)
- Oh, and an updated website http://juggernaut.rubyforge.org

And, Juggernaut now works over port 443 which gets round most firewall problems.

Some things to watch out for are that on OS X (and probably linux), you need to start the push_server with sudo if you are using ports lower than 1024.

For the future, I will be making deployment easier and cleaning up the push_server.

Juggernaut has recently been featured on ajaxian.com, regarding its usage in 64 Squares, a chess game.

Flex, Juggernaut | Comments | Trackback Jump to the top of this page

2 comments on “Juggernaut for Flex”

  1. 01

    Great stuff.

    In currently tinkering with Juggernaut and have found that the logout notification is missing channels data. How could I go about implementing this?

    Eg. A user leaves a channel, the channel should be notified that the user has left.

    jason at July 27th, 2007 around 2:29 pm
    Jump to the top of this page
  2. 02

    […] ActiveMessaging, and STOMP (post 1, post 2) - Alex McCaw is the creator of Juggernaut which can use Flex or Ajax to push messages on Rails (using a Flash socket) - Renaun Erickson has an example using […]

    Vixiom Axioms » Everybody's chatting about Flex at August 2nd, 2007 around 1:11 pm
    Jump to the top of this page

Leave a Reply

  •  
  •  
  •  

You can keep track of new comments to this post with the comments feed.

19yr old hacking away at Ruby on Rails and Flex

Pages

Meta