将 APE 与 PHP 结合使用
我对 APE(Ajax 推送引擎)的工作原理有点困惑。
- 您如何知道从 PHP 应用程序推送到哪个连接,确保用户正确?
- 它是 Apache 扩展吗?独立服务器?等等...
一些解释会很棒,谢谢!
I'm a little confused on how APE (Ajax Push Engine) works.
- How do you know which connection to push to, making sure the user is correct, from a PHP application?
- Is it a Apache extension? Independent server? ETc...
Some explanations would be awesome, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
APE 使用独立的 HTTP/Comet 服务器,例如允许长轮询。它需要对旁边运行的 Apache 服务器进行一些配置。它使用服务器端 javascript 框架来开发模块。
在客户端,它使用 JavaScript 框架来接收 APE 服务器发送的信息、处理数据并发回用户请求。
加载页面时,将使用
var client = new APE.Client();
创建一个新客户端,然后客户端将连接到服务器。更多信息此处
APE uses a independent HTTP/Comet server that allows, for example, long-polling. It needs some configuration made to the Apache server running beside it. It uses as server-side javascript framework for the development of modules.
On the client side of things it uses a javascript framework that receives information sent by the APE server, handles data, and send back the users requests.
When the page is loaded a new client is created with
var client = new APE.Client();
and from then on the client is connected to the server.More information here
关于1)
您不能直接“推送给用户”。
您可以从 PHP 执行的操作称为“内联推送”。
基本上,您需要在 APE 服务器上调用 FROM PHP 命令,传递您想要发布的信息以及将数据推送到的 APE 服务器的一些信息。
这要求您跟踪 APE 服务器上的登录用户(最好通过用户名/登录)。
APE 本身没有任何有关连接用户登录的信息,您需要创建一些函数来执行此操作。
可以在此处找到围绕该主题的博客文章:
http://www.xosofox.de/2010/10/ape-user-处理/
Regarding 1)
You cannot "push to a user" directly.
What you can do from PHP is called "inline push".
Basically you need to call a command FROM PHP on the APE server, passing the information that you want to post ALONG with som information for the APE server WHOM to push the data to.
This requires you to keep track of your logged in users on the APE server (preferably via username/login).
APE itself does not have any information about the login of connected users, you need to create some functions to do so.
A blog post that around that topic can be found here:
http://www.xosofox.de/2010/10/ape-user-handling/