Link to home
Start Free TrialLog in
Avatar of jyhiroko
jyhiroko

asked on

JSP Instant Messenging

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..
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of jyhiroko
jyhiroko

ASKER

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?
Will the message auto pop up on the receiving end automatically  upon submition by the sender?
>  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...
The problem is i got a solution for this.. but i need it to be real time. instead of contanst refreshing. Any alternative solutions?
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
how to do it using applet?
how to do it using applet?