This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A query regarding the one-to-one chat module

 
Jignesh Gohel
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have made a general chat application using JSP & Servlets.
Now i am making an additional one-to-one chat module in my application.

So if you could please give me a suggestion about this one-to-one chat module ie ,how to make it possible that when i send one message which should be personaly viewed by intended user, it gets displayed on the intended users window .

Temporary i have written the servlet code for sending the message by the user who wants it to be received by the intended user using a simple textfield & send button & i am successful in sending the message ie on the JSP side I'm getting the message printed with the sender's name.

Now how to approach for making the intended user receive the message personally on his own window/page if he is chatting with me(for e.g).

My whole user interface has been made using HTML & JSP code inside it.

Thanking you,
Jignesh
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jignesh,
You need to have the page periodically query the server to see if there are new messages. Take a look at gmail for an example of this.

On the server you need to keep track of who the message is for. Then when a certain id checks to see whether there are messages, you can check the id.
 
Jignesh Gohel
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
Thanks for your reply.
You said,
On the server you need to keep track of who the message is for. Then when a certain id checks to see whether there are messages, you can check the


But sir i don't know --on the server side how to keep track of who the message is for???
So if you could help me make understand through a small snippet of sample code ,I would be very much grateful to you.

Thanking you,
Jignesh
 
Sarath Mohan
Ranch Hand
Posts: 213
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If a user sends a message you encode sender info along with the message.Parse the message to idetify who sends the message. You can also encode reciipient in the message if it is a private or one-to-one message.

Cheers
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic