Solved

JSP Instant Messenging

Posted on 2003-11-11
9
303 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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 250 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse problems view not showing all the time 4 88
J2SE 5.0 metadata 1 57
SimpleDateFormat.parse examples 19 94
listing all functions in JavaScript 19 202
Google always has something new and amazing up its sleeve, and the most current thing that they have been working on is another step in the evolution of Google Search, from machine learning to its brilliant successor, deep learning.
The question appears often enough, how do I transfer my data from my old server to the new server while preserving file shares, share permissions, and NTFS permisions.  Here are my tips for handling such a transfer.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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