在 Apache 服务器上使用 WebSocket [英] Using WebSocket on Apache server

查看:101
本文介绍了在 Apache 服务器上使用 WebSocket的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着围绕 WebSockets 的所有嗡嗡声,很难找到关于如何在 Google 上的 Apache 服务器上使用它们的好的演练.

With all the buzz around WebSockets, it's pretty hard to find a good walkthrough on how to use them with an Apache server on Google.

我们正在用 PHP (symfony2) 开发一个插件,它会不时运行一个聊天实例.在这方面,我们发现 WebSockets 比 AJAX 更有趣、更标准、更快速.问题是,我们组中没有太多系统管理员资源,我们发现很难收集有关以下事项的好信息:

We're developing a plugin, in PHP (symfony2), which will run from time to time kind of a chat instance. And we find WebSockets more interesting, standard and quick than AJAX for this matter. The thing is, we don't have much sysadmin ressources in our group and we find hard to gather good informations on the following matters:

  • 我们能否在传统的 Apache 专用服务器上运行 WebSocket 实例?如果是,您是否有对我们有用的链接?
  • 如果我们需要修改服务器,您会推荐什么样的工具,因为我们在系统管理员方面不太熟练,因此我们无法承担高昂的维护费用.

非常感谢,

ps:我们将链接回您的博客/网站,因为我们将在我们的开发博客上发布关于我们应用的这一部分的技术/信息帖子.

ps: we'll link back to your blog/site as we'll make a technical/informational post on our devblog about this part of our app.

再次感谢您!

推荐答案

一个途径是使用独立安装的 web sockets 服务器.

One path is to use an independent installed web sockets server.

对于 PHP,您可以尝试:http://code.google.com/p/phpwebsocket/http://github.com/Devristo/phpws/

For PHP you can try: http://code.google.com/p/phpwebsocket/ or http://github.com/Devristo/phpws/

您也可以尝试其他一些项目.

There are some other projects which you can try as well.

基本上,您需要上传、解包并开始运行该过程.

Basically, you need to upload, unpack and start running the process.

在前端,您将使用 javascript 连接到特定端口上的服务器.

On the frontend, you'll have javascript connecting to the server on the specific port.

大多数 websocket 服务器都有一个演示,可以回显它听到的任何内容,所以这是编写一些测试代码的好地方.您甚至可能会找到一个基本的聊天实现.

Most websocket servers have a demo which echoes back whatever it hears, so this is a good place to write some test code. You may even find a rudimentary chat implementation.

棘手的部分是监控网络套接字服务器并确保它平稳、持续地运行.

The tricky part is to monitor the web socket server and to make sure it runs smoothly and continuously.

尝试在尽可能多的浏览器/设备上进行测试,因为这将决定您选择哪种 websocket 服务器实现.您必须注意新旧协议.

Try to test on as many browsers/devices as possible as this will decide on which websocket server implementation you choose. There are old and new protocols you have to watch out for.

这篇关于在 Apache 服务器上使用 WebSocket的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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