Understanding IM


Instant messaging or IM as it is more commonly called is something that many users of the internet take for granted. It is the simple ability to send a message instantly to another user. Like SMS it doesn't sound like much but there is a lot going on behind the scenes.

The first challenge facing someone developing an IM-based application is the concept that the event gateway itself is, in effect, an IM client. The server will log on to the IM network in the same way that any other user will log on. It will appear in your IM list as a user and to all outward respects, it is a normal user.

The second challenge is how to build an application that makes sense to a user who is coming in from an IM client and to have that user interact with the rest of the application in a meaningful way.

Figure 32.1. This shows how the various pieces of the IM puzzle fit together.


The other challenge in the IM space is "Whose IM client are we going to support?" Personally I have IM accounts with MSN, Yahoo!, AOL and Jabber. Why so many? Well this all has to do with standards, as with almost everything on the internet today. There are a multitude of defacto standards that evolved before we really knew what we were doing and everyone had their own idea about which IM client was their favorite. This led to a series of different protocols and different clients and now it seems that you need an account on every different IM network just to talk to everyone you know. Luckily there is a solution; the IETF (the Internet Engineering Task Force) has ratified an open standard, the eXtensible Messaging and Presence protocol (XMPP), which will allow for a degree of interoperability and a wider range of supported clients in the future.

For more information on XMPP head to http://www.xmpp.org


Out of the box ColdFusion only has native support for two IM protocols, XMPP and Lotus SameTime. Some have mentioned that this appears to be a bit limiting but as with all of the gateways, you can always create your own and at the time of writing this there are various third party organizations that are in the process of doing just this. In particular, Zion Software has a product called JBuddy that lets you connect to other messaging networks, such as AOL's AIM network. They are currently working on a version, called JBuddyCF that will plug into ColdFusion to provide similar access natively in ColdFusion.

As XMPP begins to evolve there will be a huge selection of XMPP clients and server gateways that will broaden the horizon of the gateways in ColdFusion today.

NOTE

To make life easier, this chapter will focus on XMPP but exactly the same principals apply to Lotus SameTime.


Understanding Presence

One of the key differences to note between and SMS application and an IM application is Presence. What does this mean? With IM, you can tell if someone is connected to the network or not, so before you send a user a message you can check to see if that user is there to receive it or not.

At first this does not seem to be much but if you think of how we use IM today, this could radically change how ColdFusion applications interact with users. Let's take a simple helpdesk application as an example. In a traditional system a user would log a support ticket and the application would email the helpdesk staff group as a whole alerting them to the fact that there was a new ticket that needed to be address. Everyone in the support team would get that email, even if they weren't in the office to deal with it.

In a presence aware application, sending out a blanket email as above would be a last resort. The application could query an IM server to determine which support engineers where online at present and IM them directly with a link to the support ticket so that it could be assigned almost instantly. If there were no support staff online, then the system could fall back to its existing email system (or maybe send an SMS message to the support engineer on call) and send an alert email.

Creating a Development Environment

Unlike the SMS gateway emulator in ColdFusion, when you are working with IM testing you need to connect your application to an IM Server.

NOTE

While writing this we used the Jive Messenger XMPP server (http://www.jivesoftware.org/) as our test server so we could totally control the environment. This is a relatively simple XMPP compliant IM server to install and configure and is available for Windows and Unix platforms.


XMPP Clients

To test your new system you will need to use an XMPP client to connect to the jabber network. There are a huge selection of clients out there, head to http://www.jabber.org/software/clients.shtml and just select one, for testing we used PSI (http://psi.affinix.com/) on a Mac and Trillian Pro (http://www.trillian.cc/) on a PC.

To complete our helpdesk application you will need to have installed an IM server (Jive in this case) and to have an IM client connected to your IM server.

Once you have your IM server installed, open up your IM client and create a new IM user. One of the neat benefits of XMPP is that users can create their own user accounts from within their IM client. You will need to create a user in the form of username@yourJiveServerName.

Once you have created your own user account, it helps to make your ColdFusion server's IM account in the same manner. Go ahead and repeat this process, creating an account for coldfusionserver@yourJiveServerName with a password of 'CFMX7' (without the quotes). We will be using this account shortly so log out for the time being.



Advanced Macromedia ColdFusion MX 7 Application Development
Advanced Macromedia ColdFusion MX 7 Application Development
ISBN: 0321292693
EAN: 2147483647
Year: 2006
Pages: 240
Authors: Ben Forta, et al

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net