Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Instant Messenger in Java

Status
Not open for further replies.

jem122974

Programmer
Nov 1, 2001
114
0
0
US
I have a java/jsp application that I'd like to have some way of instant messaging all the users that are currently signed in. I'd like it integrated into the system, so they don't have to log on to two different things. Can anyone point me in the right direction?

Thanks,
Jon Mitchell
 
Actually I did look at Jabber, but it seems to me a little too advanced for what I want to do. But maybe I'll email someone there and tell them what I'm looking for and see what they can do.

All I really want is a way to notify all the users currently signed into the system to please sign out. I want this to be invisible to the user. It seems there should be some way to do this right in my Java web application.

Any other thoughts, anyone?
 
The only way a web browser receives information is when IT requests it. Perhaps you can send an email to all users, that are currently logged in. You will of course need a database cross referencing their login with their email address.
 
Hmmm... Email is pretty good, but I'm not sure how often some of the users will check theirs. This is currently what I am doing.

Any other thoughts?
 
What about creating a status panel in a frame that is always displayed that opens a stream, down which you can send messages to be displayed (a bit like a news real panel, or stock market ticker price panel)
 
One option that we used in the past was to use IRC...and create a applet on your jsp page to display the messages. Another option is to use the OS do this task...ie. in windows use 'net send' ...

 
Would they only see the messages when they refreshed the screen?

I've thought of storing my message in a application bean in our JSPs and then when the user refreshes their screen or goes to another screen then check this application bean for a message and write it to their screen. Sound good?
 
It looks like the user would have to run some type of IRC client for that to work. We don't want them to have to get any extra software to use our system, just the internet. Is there a way to write my own client in Java that would connect them?
 
In Java 1.4, the AppletContext object now has getStream and setStream methods(). Can you not use these to stream data (i.e. text messages) to your applet.

// get the AppletContext
java.applet.AppletContext ctx = getAppletContext();

// get a URL which will write data to its outpurStream.
// get the InputStream to this URL.
InputStream is = url.openStream();
// set the Stream
ctx.setStream("dataStream", is);

After the above has been done, in the call to init(), create a thread that reads from the inputStream. This needs to be in a thread, as the read will be blocked until something is read.

When something is read, set the text in a "status" panel of your applet.

These are simply some ideas, as I haven't attempted it myself, but I gues this is how stock market prices are relayed to browsers, and news updates sent to news banners.



 
Hmmm... thanks, this gives me something to look in to...
 
I tried this with Java 1.4 and it seemed to at least sent a message to the InputStream. The problem is that we are currently running Java 1.3. Any suggestions on how to do this in 1.3?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top