?
Solved

JSP Instant Messenging

Posted on 2003-11-11
9
Medium Priority
?
312 Views
Last Modified: 2010-04-01
Can anybody suggest a way to implement a service where a user post a text message and it appears instantly(not instanly but real time) on the admin( or simply just another user)'s screen automatically. like a chat sesson just that the receiving end user will not be replying. If possible try to be as detail as possible in offering ideas or solutions for I am new to jsp.. (nv done anything in it b4) thanks:> ^_- cheers. Do offer links to tutorials or source code of related topics.
PS: Both receiving n sending users are connectin thru a web broswer. Sort of like a moderator at home receiving comments real time..
0
Comment
Question by:jyhiroko
  • 5
  • 3
9 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 9721935
If you store a list of all the current sessions (using a session listener to add them into a Hashtable when they are created, and remove them when they are destroyed)

Then you could store an ArrayList of messages inside the session object, and the user could be shown the last n messages that they recieved...

Of course, this is a transient solution, as if the user has simply closed their browser, then they will never recieve the messages

So you will need to store the messages in some permanent format (file or db), and then when the user logs on, or visits a page, check for new messages in the db and return them to the user...

Tim.
0
 

Author Comment

by:jyhiroko
ID: 9721987
Method seems clear but i got no idea how to implement this.. let me try to digest it for a while. Any source to refer to?
0
 

Author Comment

by:jyhiroko
ID: 9722010
Will the message auto pop up on the receiving end automatically  upon submition by the sender?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 35

Expert Comment

by:TimYates
ID: 9722035
>  Will the message auto pop up on the receiving end automatically  upon submition by the sender?

No, you will either need:

a)  A frame which is constantly refreshing, and shows a popup if a new message has been recieved

or

b)  Only check when the page is loaded, and show a popup then...
0
 

Author Comment

by:jyhiroko
ID: 9722044
The problem is i got a solution for this.. but i need it to be real time. instead of contanst refreshing. Any alternative solutions?
0
 
LVL 35

Accepted Solution

by:
TimYates earned 750 total points
ID: 9722104
JSP and web browsing in general is a "Client Pull" technology...  The server cannot just arbitrarially "push" data to the browser...

Alternative solutions:

Java Applet that checks for new messages every n seconds
   PRO:  less data fetched each time
  CON:  extra level of complexity -- OSX doesn't have LiveConnect for example

I'd do the small (hidden?) frame that checks every 30 seconds or so...
0
 
LVL 1

Expert Comment

by:JNic
ID: 9722110
If you really need real real-time :) I am afraid you need to write an applet.... - Which does not have a lot to do with jsp.
0
 

Author Comment

by:jyhiroko
ID: 9722210
how to do it using applet?
0
 

Author Comment

by:jyhiroko
ID: 9722211
how to do it using applet?
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Moore’s Law has proven itself time and time again since it was first introduced. So what’s next? Will Moore’s law continue to remain relevant, or will new technology take over and bring us the next big advancement in computing?
In the below post we have mentioned the best hosting type for startups. Also, check out some of the superlative web hosting companies that are proposing affordable web hosting solutions to host your startup website.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question