I just released a new improved version of ajaxCFC for the Model Glue framework. Now it's even easier to add Ajax to your robust ColdFusion MVC applications. I modified the Echo Example and added a Contact Manager Example to show how it works. All open source and included in the ajaxCFC download. The contact manager example is the same that comes with Model-Glue, using the same controller, models, and views ... slighly Ajaxified :)
[Updated] IMPORTANT NOTE: The XML Socket works on port 1225, so if you're behind some firewall preventing that traffic you will not see the refreshes. I am still working on some port 80 proxy, but for this experiment just open that port.
btw, I will be demonstrating all this at the upcoming Spring Conference, this week.
If that wasn't enough, included is also the next level of Web 2.0 applications; a mash-up of ColdFusion / Model Glue / ajaxCFC / XML Binary Sockets / CF Event Gateways... This combinations allows you to only for your presentation layer to interact with the server in the background, but also for the server to push data to the clients. No more Ajax pulls every 3 seconds interval, now the server can just broadcast the command to all clients. I shall call it Apocalypse. ;)
I modified the Contact Manager example that comes with model glue to use Ajax and Socket servers... now every time anyone adds/edits/deletes a contact all clients' views will get updates... just imagine the possibilities. Just try it yourself... open two browsers and see them interact.
I will try to briefly explain the framework the best I can.
First, you need the BER version of the model glue framework; Joe still hasn't officially released MG v1.1.
How do it work...
The examples that come with Model-Glue use a private Layout hanlder, so I just added two more: AjaxLayout and SocketLayout... Now every time you need to respond an Ajax request you use the AjaxLayout, and if you want to broadcast something through the socket, you use the SocketLayout.
I modified the controllers init and OnRequestStart to parse the Ajax request... once it gets to your controllers handler all Ajax vars will be sent to you as regular event values, which you can get with getValue. There's not much more you need to know there...
Your controller will do its thing and set vars to be used in modelglue.xml ... now, here's the beauty ... when you use the AjaxResponse renderer your views will modify DIV Layers, or anything with the view's ID ... For example, if your body has a container calls contentForm, once you render a view with that name, all content will get placed inside that DIV...
If you need to run scripts you can use a reserved view name: 'script'. If you create a view with that name, all code inside that view will get evaluated in the client side. I modified the Echo Example to use this method so you can see what I mean.
The socket implementation is still in alpha mode... I just finished the prototype today... how does it work?!
I included the org.gonda.socket.jar file, which would have to be registered as a custom event gateway to make the contact manager example to work. Just point your JVM class path where the file is, restart ColdFusion, and register a new gateway:
Then create a new instance and call it 'flashSocket1'. I provided the cfg file in the example too.
In the main view, both IP and port are passed to the Flash file as FlashParams... will easily see how to modify it.
I know, you are thinking it's too much, but it's not THAT complicated ... and it's well worth it ...
Ok, so what is the catch? There are a couple of issue I still need to work on ... one) The socket binds itself to an IP and port, and I don't want to create a new socket for every application.. especially if I need to open a new IP on my firewall every time ... two) firewall... yes, I need to find a way to perform http tunneling, or to detect that it was blocked on run time to shift all socket calls to Ajax.
I know it's not crystal clear, but I wanted to get it out there and get people thinking ... I'll try to document it better this week before the conference.
Rob Gonda has gotten an implementation of data push working with ColdFusion. It's pretty slick in the way that it talks to the XML Socket. Go over to his site and take a look at it....
Wow - this is pretty slick. By using his AjaxCFC, an event gateway, and a tiny Flash movie as a conduit, Rob Gonda has come up with a way to do *push* in Model-Glue via Ajax. That...is...pretty...slick!
Looking at the header over at Rob Gondas blog one must wonder if he think himself some kind of super hero. Well today he has proven his position as such - at least in my eyes. The MG+Ajax examples he has posted is truly cool stuff.
When the <a href="http://www.game4power.com/">Wow Gold </a> wolf finally found the <a
href="http://www.game4power.com/">Buy Wow Gold</a>hole in the chimney he crawled <a
href="http://www.game4power.com/buy-gold/">wow gold cheap </a> down and KERSPLASH right into
that kettle of water and that was <a href="http://www.wowgoldone.com/"> cheapest wow gold
</a> the end of his troubles with the big bad wolf.
<a href="http://www.game4power.com/">game4power</a>,<a href="http://www.game4power.com/buy-
gold/">buy cheap wow gold</a>
<a href="http://www.meinwowgold.com/">WOW GOLD</a>
The next day the <a href="http://www.wowgoldone.com/"><strong> cheap wow gold
</strong></a><a href="http://www.game4power.com/">buy gold wow</a> little pig invited his
mother over . She said "You see it is just as I told you. The way to <a
href="http://itemchannel.com">wow gold</a>get along in the world is to do <a
href="http://www.itemchannel.com/">world of warcraft gold</a> things as well as you can."
Fortunately for that little pig, he <a href="http://www.game4power.com/buy-gold">cheapest
wow gold</a> learned that lesson. And he just lived happily ever after!<a
href="http://www.aionkina.com">aion gold</a>,buy aion gold.