Page 1 of 1

Text Chatting after logging in

Posted: Wed Sep 26, 2007 11:54 pm
by kkonline
Hi,
I am working on an application for which the registered users who have logged on (say A) should be able to chat with another person (say B) when A visits the profile of B.

Till now i am completed the user management system using session and as a programmer i know if A and B have logged in next I want to allow chat between then (similar to gmail perhaps) what should be the logic approach ?

Posted: Thu Sep 27, 2007 3:30 am
by Chris Corbyn
You could mark a field in the database as "logged_in" for each user so you know who's logged in. Then for the chat you'll probably want to use AJAX and put messages into a temporary table. It's far too complex to simply post code here for but the logic I'd take would be something like:

1. Generate a unique "chat_id" based on all users involved in the chat.
2. Put messages into a table "chat_conversation" or similar.
3. Use AJAX to keep requesting a lookup of new messages where the chat_id matches the current chat.