How to implement a real fast web chat with PHP?

前端 未结 3 1523
面向向阳花
面向向阳花 2021-01-01 00:32

How to implement a real fast web chat with PHP?

Has anybody ever wonder why Facebook chat is just so really really fast? even in IE without WebSocket.

Isn\'t

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-01 00:50

    The instantaneous chat you're describing is generally acheived by a something called "Long Polling" or, if we're talking about AJAX, "Comet" (Wikipedia talks about it). Polling tends to strain Apache servers, but there are some specialized servers to deal with it like APE. I'm not sure but I think you can do the same with NodeJS and NGINX handles the stress pretty well.

    Here's an article here about how to implement a long polling chat with PHP jQuery and AJAX.

    Best of luck, and I hope it helped!

提交回复
热议问题