ajax实时消息系统

                <div class="grid--cell fl1 lh-lg">
                    <div class="grid--cell fl1 lh-lg">
                        It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and   cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,   <a href="/help/reopen-questions">visit the help center</a>.

                    </div>
                </div>
            </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2012-09-17 11:38:26Z" class="relativetime">7 years ago</span>.</div>
        </div>
    </aside>

I've got a basic idea for a message system, but could anyone point me in the right direction in what I'm looking for. I'm guessing I'd have to use ajax to perform this but say you have two users messaging each other back and forth, rather then having to refresh the page to read the new message, it would pop up automatically, live.

</div>

Why voting down guys? The OP just wants an idea about doing it.

This is a simple procedure to a live messaging system:

  1. User logs-in into the site.
  2. If the site is registration based and every user has it's own unique ID, skip the 3rd step.
  3. If the site is just Nick-name based and doesn't require you to sign in you should store a temporary ID on the user's browser as a session variable.. ( The temporary ID can be easily made using the SQL's auto increment function, in this case you need to store a temporary row in a table in database for every user.)
  4. User selects the recipient or the site selects it randomly. And again the recipient ID is stored in user's browser using session variables.
  5. Now a chat screen is displayed to the user using simple HTML/AJAX. ( We have created a div for the chat screen and we programmed it to load the get script using AJAX/Javascript and refresh every x seconds)
  6. User sends a message and the message is sent to the send php script using AJAX and the send script stores the messages along with the sender and the recipient to a table in a database
  7. The recipient's screen refreshes and he sees a new message. And can respond. When responding the whole procedure goes on again from the 5th step..

Something looking bad? ask!