A few months ago I started looking at how I could "push" data from Coldfusion to Flex with Live cycle. I was able to get datagrids to sync among Flex client's but it took some serious modifications to several of the XML files and started as one of the code generated master pieces in Flexbuilder. Recently I decided to revisit this and approached this using event gateways. I started with this as a base: João Fernandes - Flex and CF.
So what is generally one of the most fun things to write, yep a chat application. I made some modifications to allow pressing enter to send data and a few bits of logic to determine what what to display. I also thought it would be fun to have a "Page me" button. This idea came from the widgets where you can embed mini versions of MSN and AIM into your website so people can chat with you without needing a long sign in process.
The best part of this is that the messages are being sent over rtmp so the data is actually pushed to the client. open 2 browsers and watch how quick the messages are sent and received. As this is setup to run over port 2048 if you are behind a strict firewall where the port is blocks it will automatically fall back to polling (every 3 seconds) over port 80.

I put some code in to eliminate people spamming me more then one per 10 mins. All this can be achieved on CF8 ( I think 7 aswell ) standard edition.
Code is available here: View Source
There is alot more that can be achieved but this is a simple example of how Coldfusion can push data to Flex.
Thanks to João Fernandes great blog and Dave Watts Max 2008 session for answering some of my questions.
The Gateway:

Subscribe to:
Post Comments (Atom)
Categories-
- Actionscript (5)
- Adobe (8)
- AIR (3)
- Apple (2)
- BlackBerry (1)
- CFML (59)
- ColdFusion (84)
- ColdFusion 8 (12)
- ColdFusion 9 (28)
- Database (2)
- Flash (11)
- Flash 10 (6)
- FlashBuilder (4)
- Flex (31)
- Internet Explorer (1)
- iPhone (4)
- Java (8)
- jQuery (1)
- Linux (8)
- Microsoft (5)
- Open Blue Dragon (10)
- Open Source (11)
- Operating Systems (3)
- PHP (1)
- Railo (24)
- SQL (3)
- SVN (2)
- Twitter (2)
- VPS (1)
- Windows (5)

Blog Archive
-
►
2010
(38)
-
►
August
(9)
- ColdFusion and cfquerynew and date times - timesta...
- ColdFusion Lists, SQL IN and cfqueryparam
- iPhone and Flash - Sucess
- ColdFusion jrun and the JVM
- ColdFusion and CFReport
- jQuery or EXTjs
- iPhone 3Gs and Flash player
- Easy way to embed ColdFusion code into your blog
- Flex and the MATE framework in Melbourne
-
►
August
(9)
-
▼
2009
(89)
-
►
December
(17)
- ColdFusion 9 and the local scope continued
- Is this an issue with the local scope in ColdFusio...
- Are you using ColdFusion 9's ORM?
- Want more performance from a default Railo install...
- WizzyWig the comic and snow
- Linux Start and Stop scripts for Ventrilo - Ubuntu...
- ColdFusion Builder Beta 3 - Any one seen this?
- Streaming AMF channel with ColdFusion 9 and BlazeD...
- Forwarding or masking your domain with GoDaddy
- Cheap ColdFusion hosting
- Should I get an iPhone?
- Full Screen Flex
-
►
December
(17)
Reccomended:
- TweetTrail
- Load Cell
- MyTouch Cases
- View Prom Hairstyles
- Cell Phone Accessories
- business operating agreement
- learn how to recycle electronics



5 comments:
true, true, JMS is a nice toy
I like it, I like it alot.
Paul, thanks for this great sample!!!
A quick question: Are there any way to create different chat rooms for peer to peer talk needs. This would be a UUID etc. parameter that we can name the rooms etc.
Any suggestion?
Thanks in advance.
Oğuz, you can create additional channels but I don't think you can create them dynamically. I'm not 100% sure. You could allocate say 100 or x amount of channels then if people wanting to chat privately they can the Flex client can control that and swap the subscriber consumer channels dynamically. I haven't tried but I would like to when I have a chance.
Paul,
Thanks for the update.
This is the main problem that we have now. Let me also check ...
Post a Comment