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.