从服务器端刷新客户端页面 [英] forece refresh client page from server side
问题描述
如何从服务器端刷新当前的客户端视图页面? 例如,如果我要强制刷新所有客户端现在正在查看的页面,以便他们可以查看新内容.并且我想在我想使用PHP的时间内进行此刷新.
How may I refresh current client view page from the server side? for example, if I want to force refresh for page that is viewing now for all the clients, so they can view the new content. and I want to do this refresh in the time that I want using PHP.
有可能吗?
推荐答案
使用Web套接字.您可以将PHP套接字与此一起使用,也可以将
Use Web Sockets. You can use either PHP Sockets with this or this
我认为php套接字要求您使用5.3或更高版本的PHP.
I think php Sockets would require you to have a PHP version of 5.3 or above.
如果您没有PHP v5.3或更高版本,则可以将 Node JS 与
If you don't have PHP v5.3 or above you can use Node JS with Socket.io
长池化也是一种选择,但是考虑到服务器将获得的请求数量,这不是一个好的解决方案.另外,用户的带宽使用率也会很高.
Long Pooling is also one of the option, but that won't be a good solution considering the number of requests your server would be getting. Also the user's bandwidth usage will go high.
这篇关于从服务器端刷新客户端页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!