nstant messaging represents a medium via which messaging partners can interact in a synchronous fashion. Correspondence can occur in a near "instant" manner. Chances are the majority of workgroups in your company rely on one of the "big four" instant messaging programs: AOL Instant Messenger, MSN Messenger, Lotus Sametime, or Yahoo! Instant Messenger. Yahoo! Instant Messenger in particular has accumulated a significant following because of its easy to use, rich graphical user interface. Facilities such as the ability to leave "offline" instant messages make Yahoo! Instant Messenger particularly attractive. If Yahoo turns out to be the instant messaging application that makes the most sense for you to use, then you'll certainly want to know about jYMSG.
YMSG (without the j) is the protocol used by Yahoo's instant messaging and chat software. jYMSG is a Java API that allows you to interact programmatically with Yahoo's messaging and chat services. For example, with jYMSG you can have an instant message sent to your system administrator from your J2EE application server when a critical error requiring attention occurs. Sending a Yahoo instant message via Java is made quite easy with jYMSG. This article shows you how to build a Swing-based application through which you can instant message your Yahoo messaging partners. Though it will not be as feature rich as the Yaoo! Instant Messenger client, you will get a good introduction to the power of jYMSG.
jYMSG is released under the GNU General Public License. It is a SourceForge.net project that has gained a significant following due to the ease of use of its API. However, it is not endorsed or supported by Yahoo! Inc. It abstracts the more complex underlying interaction with Yahoo's publicly released API. Before you get started using it, read the "Compatibilities" sidebar to make sure you have dependencies covered.
jYMSG is written purely in Java and uses no native code. Consequently, you can use the API on basically any platform that supports Java.
To begin, download the jYMSG API from SourceForge. Because of a change in the login protocol, you will need to download a patch packaged as a JAR file that will allow you to connect to Yahoo via the API. This patch JAR (ymsg_network_v0_51.jar) will need to replace the ymsg_network_v0_5.jar, which ships with the v 0.5 download. This file as well as ymsg_support_v0_5.jar will need to be included in your runtime and Java build path.
The jYMSG API supports a slew of the Yahoo Instant Messenger protocol's offerings, some of which are outlined below:
- Fallback ports
- Login timeouts
- HTML/Socks proxy support
- Groups and Friends list
- Adding and removing friends
- Typing notification
- File Transfer
- New mail updates
This article showcases just some of the API offerings of jYMSG; a full list of capabilities is available on the project page
. But this article should prepare you to venture out on your own, focusing, in particular, on jYMSG's messaging support.