开发者

Comet / Long Polling / Forever Frame Question

开发者 https://www.devze.com 2023-02-27 01:32 出处:网络
Just discovered Comet, and am very confused. Can someone tell me what the consensus is on the best method for implementing Comet? I am trying to discover which method I should use, or if I need to use

Just discovered Comet, and am very confused. Can someone tell me what the consensus is on the best method for implementing Comet? I am trying to discover which method I should use, or if I need to use different methods across brows开发者_C百科ers for the best results.

Also, I use PHP on the server side, is there a problem with mod_php and Comet, with holding long requests - I am willing to switch to Python if so. Any links, opinions, or information is very much appreciated. I just want to know the right direction to go in.


HTML5 implements a comet method of sorts that will be the best way, but it is not widely supported yet.

Currently I would use long polling with php, but you have to keep re-establishing the link before php timeout. This is a fairly server resource intensive process though, as the server is waiting and keeping the socket open, it blocks other processes from starting.

The best way, is to use a javascript based server - probably node.js to deliver content and long polling to collect it. Node.js has the advantage of being non-blocking whilst waiting, so does not eat server resources.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号