Details:Http://www.phpyan.com/home/article/350.html Two ways to achieve this: One: IFRAME + server Push Technology Comet (reverse Ajax, that is, the server pushes data to the browser) Two: Ajax persistent connection + long polling Customer service using the first way: IFRAME + server Push Technology Ideas: 1: New comentbyiframe.php The file uses while (true) to connect to the server continuously. If new data is found in the while process. Use Ob_flush to push the Apache server. Apache then uses flush to push to the browser. 2: Create a new HTML page and insert an IFRAME. The IFRAME's SRC is comentbyiframe.php. and hide the IFRAME. The data obtained by comentbyiframe.php is output to a function in the parent window with JS. The function appends the information to the specified chat window 3: As long as the client receives data from the user. It shows as "xx says to you ...". Just click on the user name on the customer service side. Can send data to the user. The client takes the second approach: Ajax persistent connection + long polling Ajax Persistent Connection: After the document is loaded (or other time), use Ajax to request a PHP file The requested PHP file loops through while (true). Delay in giving Apache the purpose of returning data. Polling refers to the time when the server is requested. If the server does not have data. Then wait. When the server has data, it is returned to the client. This completes an HTTP request after the request and response. It's not over yet. The client receives the data and then goes to the server to have the data. This is polling It's like a beggar. If you don't give him money, he'll keep following you. After you give him the money. He is not satisfied, and came to you. Implementation ideas: After entering the client. If there is no user name. Use Setcookie to set a user name. Then persistent connection via Ajax. Continue to request data from the server (that is, customer service sent to the user's records)
Above the introduction of PHP Development Customer service System source (persistent connection + polling + reverse Ajax), including the content, I hope that the PHP tutorial interested in a friend helpful 。