Programming a Chat


General J2EE: Programming a Chat

  1. Programming a Chat (1 messages)

    We do a project which is plug-in of built-in-chat on websites. We are working with a database in order to store all the details of the chat users . We did all technical stuff of creating the DB and reading from it etc. but we encounter a big problem when we try to send a message from user A to user B . Actually we know how to send the msg from user A but we do not know how can user B gets it . How does he aware of getting a new msg ? and how does we find user B ? via IP or something ? because if so we don't know how to do it. We wil bw happy to hear suggestion such as Technologies which solve the problem or some source codes which can help us. Thank a lot in advance. Eli

    Threaded Messages (1)

  2. See Comet[ Go to top ]

    If I understand correctly, you are wondering how can the server let user B know *in real time* that a new message has been typed in the chat. Essentially, you are looking for a kind of server push technology. There are multiple solutions to this, but I suggest you take a look at implementing a Comet-style system (see here). That's what a lof of interactive web sites use to notify users of server events in real-time (Facebook's chat for instance is based on Comet). We use it ourselves for our Collaba platform's live chat module. The beauty of Comet-style communication is that it's quite easy to implement and does not require Flash, Java or any browser plug-in. It just works with plain Ajax.