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 ?
Text Chatting after logging in
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
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.
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.