For more information, see the web real-time chat program (one-to-one chat). how can I design the message receiving function?

Source: Internet
Author: User
For more information, see the web real-time chat program (one-to-one chat). how can I design the message receiving function? This post was last edited by stneo1990 at 15:48:51

PHP-based real-time web chat program, one-to-one online real-time chat, not one-to-many, not many-to-one

Message sending is relatively simple, because a client can identify the submission operation.

But how should I design the message reception better?
My idea is: can the receiver receive messages only after the sender sends a message? when the sender does not send a message, the receiver does not request data.

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


Reply to discussion (solution)

What you said seems to be the idea of submitting on a general webpage.
In the past few days, we still need to consider persistent connections + socket/websocket.

What you said seems to be the idea of submitting on a general webpage.
In the past few days, we still need to consider persistent connections + socket/websocket.

Currently, the information I have found has three statements (I don't know if there are duplicates ):
1. persistent connection
2. Round Robin
3. websocket

I don't know if all three of them can fulfill my goals?

Persistent connection + socket is not easy to implement without controls in the browser
Websocket is html5 and not all browsers support it. only a newer version can be used.
There is an example of ajax round-robin on the internet. you can search for it.

Persistent connection + socket is not easy to implement without controls in the browser
Websocket is html5 and not all browsers support it. only a newer version can be used.
There is an example of ajax round-robin on the internet. you can search for it.

In this case, it should be ajax round robin. in this case, it should be long polling.

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.