Ask, web online real-time chat program (1 to 1 chat), where the message received this function, should be how to design better?

Source: Internet
Author: User
Tags live chat
This post was last edited by stneo1990 on 2013-08-03 15:48:51

PHP-based Web real-time chat program, 1 to 1 live chat online, not 1 to many, and not more than 1

Sending messages is simpler because there are client commit operations that can identify

But what should be better to receive messages?
My idea is: Can the receiver only send the message after the sender to perform the receive operation, when the sender does not send a message, the receiver will not request data.

In addition, a user is both the sender and the receiver, mainly depending on the user's current operation


Reply to discussion (solution)

Look what you're talking about. The idea of submitting in a general Web page
In the sky or consider long connection +socket/websocket bar

Look what you're talking about. The idea of submitting in a general Web page
In the sky or consider long connection +socket/websocket bar

At present, I have found three kinds of information (I do not know if there are duplicates):
1. Long connection
2. Polling
3, WebSocket

Do not know whether these three kinds of can all accomplish I say goal?

Long connection +socket If no controls are implemented in the browser it is not easy
WebSocket is HTML5, not all browsers are supported, only newer versions of the can try
Ajax polling online There are examples, you can search

Long connection +socket If no controls are implemented in the browser it is not easy
WebSocket is HTML5, not all browsers are supported, only newer versions of the can try
Ajax polling online There are examples, you can search

Well, then it should be the Ajax poll, and that case, it should be a long poll.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.