是否有AJAX的替代不需要轮询而不断绝侧的修改? [英] Is there an alternative of ajax that does not require polling without sever side modifications?

查看:231
本文介绍了是否有AJAX的替代不需要轮询而不断绝侧的修改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个小的和基本的Ajax的基础多人游戏。对象的坐标正在由一个PHP的处理给定。这handler.php文件被轮询每200ms,使用AJAX。

I'm trying to create a small and basic "ajax" based multiplayer game. Coordinates of objects are being given by a PHP "handler". This handler.php file is being polled every 200MS, by using ajax.

由于没有需要轮询的时候什么也没有发生,我不知道,是否有东西可以做同样的事情,无需频繁轮询?例如。彗星,虽然我听说你需要配置的服务器端应用程序的彗星。这是一个共享的网络服务器,所以我不能做到这一点。

Since there is no need to poll when nothing happens, I wonder, is there something that could do the same thing without frequent polling? Eg. Comet, though I heard that you need to configure server side applications for Comet. It's a shared webserver, so I can't do that.

也许prevent甚至从返回响应,如果没有有在客户端要更改的handler.php文件,这可能吗?再说你还是无益要求,即使一些还没有发生变化的响应客户端。基本上,它应该只使用带宽和服务器资源,如果有什么需要被告知给客户端,例如。对象的坐标的变化。

Maybe prevent the handler.php file from even returning a response if nothing has to be changed at the client, is that possible? Then again you'd still have the client uselessly asking for a response even though something hasn't changed yet. Basically, it should only use bandwidth and sever resources if something needs to be told to the client, eg. the change of an object's coordinates.

任何想法? :)

推荐答案

下面是一个解决方案 - 使用SaaS的彗星提供商,如 WebSync开 - 需求。没有服务器资源的担心,共享主机或没有,因为这一切都卸载了,你可以根据需要推出的信息。

Here's a solution - use a SaaS comet provider, such as WebSync On-Demand. No server resources to worry about, shared hosting or not, since it's all offloaded, and you can push out the information as needed.

由于它的SaaS,它会与任何服务器语言。对于PHP,已经有出版商书面和准备去的。

Since it's SaaS, it'll work with any server language. For PHP, there's already a publisher written and ready to go.

这篇关于是否有AJAX的替代不需要轮询而不断绝侧的修改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆