Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Stacking Messages Similar to Gmail's 'Conversations'
Old 01-29-2008, 03:32 PM Stacking Messages Similar to Gmail's 'Conversations'
Extreme Talker

Posts: 182
Trades: 0
I am working on an application that requires message stacking similar to that of Gmail's 'conversations'. I am tossing around different approaches to this issue. I have yet to come up with anything that I like.

I tend to over complicate things, so I was wondering if anyone cared to offer up possible approaches to this?
bhgchris is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-01-2008, 07:26 PM Re: Stacking Messages Similar to Gmail's 'Conversations'
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
I don't understand what you mean by "message stacking similar to that of Gmail's conversations" - Can you provide a screen shot?
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 02-01-2008, 11:28 PM Re: Stacking Messages Similar to Gmail's 'Conversations'
tazmanny's Avatar
Banned

Posts: 16
Name: manuel
Trades: 0
do you mean (creating a pop server?) or (imitating gmail server making it look like if you sent an email from gmail)
tazmanny is offline
Reply With Quote
View Public Profile
 
Old 02-02-2008, 12:05 AM Re: Stacking Messages Similar to Gmail's 'Conversations'
Extreme Talker

Posts: 182
Trades: 0
Hmm...Perhaps that is why I haven't had any replies, lol.

Gmail gives you the ability to chat with other Gmail users directly from your Gmail account. No 3rd party software is required, it's all web-based.

By 'stacking', I simply mean the way they group these chats/conversations. They group the conversations you have with other users with timestamps, etc.

Maybe 'chat logging' is a better way to put it.

Recently Gmail started offering the ability to have multiple users in one conversation. I'm not worried about that. I just need to handle 1 to 1 chatting.

I think this may still be unclear, but feel free to take a shot at what you think I'm talking about O_o I'll hopefully be able to clear it up some more.

Thanks!

Chris
bhgchris is offline
Reply With Quote
View Public Profile
 
Old 02-02-2008, 03:09 AM Re: Stacking Messages Similar to Gmail's 'Conversations'
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
It sounds like you're talking about a chat system and are throwing in Google b/c you like their presentation of it. There are 2 options I choose from when doing this:

1) Log the chat to a database.
2) Log the chat to a file.

I do #2 when the file is regularly deleted and I don't need to query it for details. I do #1 when I want the log of chats saved and may want to query it for deeper analysis. Presentation is a whole other matter. For that, I use Ajax.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-02-2008, 03:31 AM Re: Stacking Messages Similar to Gmail's 'Conversations'
Extreme Talker

Posts: 182
Trades: 0
Thanks for your reply, Jeremy!

I'm not concerned about the aesthetics at all.

I can easily log every message that is sent and received, and I will be using AJAX for 'real time' chatting.

My dilemma is this:

How should I group the messages into conversations ( like Gmail )?

What will mark the beginning and end of a conversation?

etc, etc.

There are many ways all of this can be done. I am just trying to decide on the best way.

I was thinking about giving each chat a lifespan when it is first initialized, and possibly resetting the lifespan each time a new message is sent or received.

I'm not sure why I am having such a difficult time wording my problem =x

Thanks again for your help!
bhgchris is offline
Reply With Quote
View Public Profile
 
Old 02-02-2008, 03:57 AM Re: Stacking Messages Similar to Gmail's 'Conversations'
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
OK. Sounds to me like your dilemma is determining when a conversation has ended. To solve that, you have to be a bit sneaky as you can't, using just ajax, maintain a persistent connection. If you code the JS so that every X seconds, it pings the server for new messages, then you will be able to update the chat if there are new message and if all members of the chat have not pinged back to see for new messages in that X seconds, then the session could be killed. You could enforce that through mathematical analysis or a cron. To do this you'd have to log the datetime of the ping backs in addition to the chat. So that your logs don't get astronomically large, you may want to setup a table which contains the members and last checked-in time in addition to a table which contains the messages (otherwise you'd be storing every check-in time and that'd be more than you care to store.)

Hope that helps.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-02-2008, 10:00 PM Re: Stacking Messages Similar to Gmail's 'Conversations'
Extreme Talker

Posts: 182
Trades: 0
The only plausible solution that I have come up with so far is similar to yours. That's what I meant by a 'lifespan'.

Each conversation would get a lifespan of say, 30 minutes or so. That means if no action ( send or receive ) has happened within the lifespan, the conversation is terminated. I was thinking of simply setting the conversation end time, each time a new action takes place.

# when a message is sent or received
$end_time = $lifespan + $now;

# when i check for new messages
If ( $end_time <= $now )
{
# terminate convo
}

That is all I can come up with, and I'm not too happy with it =x
bhgchris is offline
Reply With Quote
View Public Profile
 
Old 02-03-2008, 06:30 AM Re: Stacking Messages Similar to Gmail's 'Conversations'
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
What's wrong with the logic? I'd enforce that through the db or a file, not sessions, but otherwise I see nothing questionable about it.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-05-2008, 01:53 PM Re: Stacking Messages Similar to Gmail's 'Conversations'
Extreme Talker

Posts: 182
Trades: 0
bleh. You're right. I thought about it some more and came up with a pretty good variation of my previous plan. I will post back when everything is finished and let you know exactly what I decided on.

Thanks for your suggestions!
bhgchris is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Stacking Messages Similar to Gmail's 'Conversations'
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.39819 seconds with 12 queries