Defining IM Gateways

Defining your IM gateway is fairly straightforward, You will need your CFC and a gateway configuration file which will tell the gateway how to connect to the IM server itself. Just to get things started, start by creating a stub CFC that will contain all of our methods. When compared to other gateways, the IM gateway has quite a few default methods.

onIncomingMessage.
This is your normal gateway method. It catches every incoming IM message and allows you to process it and respond to it. You might want to make sure that you always respond in some way to an incoming message otherwise your virtual IM user will appear to be ignoring your users.

onAddBuddyRequest.
This method is called when another user attempts to add your virtual IM user to their buddy list. Once they have added you to their list they can then see the presence state of your application. This can be very powerful especially in our helpdesk scenario as this could say if the helpdesk is manned and if it is busy or not at one glance to a buddy list.

onAddBuddyResponse.
When your gateway adds other users to its own buddy list, the responses to these requests will be handled here. Also if a user asks to be removed from your buddy list, you will need to handle it here as well.

onBuddyStatus.
Once you have other IM Users on your list, their status will be relayed to you every time it changes and captured in this method. You will need to capture and store this status information if you wish to use it in your application.