问题描述
寻找 Web Sockets 实现的 Hello World 类型示例:
Looking for Hello World Type Example of Web Sockets Implementation:
这是来自 php.net 的 Socket Create 参考,但这看起来更底层比网络套接字.
Here is Socket Create reference from php.net but this looks more low level than Web Sockets.
我想在 caniuse.com 上使用此 Web 套接字,现在已在所有新专业中实现浏览器.
I want to use this Web Sockets as shown here on caniuse.com which is now implemented in all new major browsers.
Google 搜索发现了这个 Nets.TutsPlus 网站在其中我可以使用 JavaScript 示例代码...但我需要知道如何在 PHP 中实现服务器端,而不是示例中的 Java、Ruby 或 Node.js.
A Google search turned up this Nets.TutsPlus site in which I can use the JavaScript example code...but I need to know how to implement the server-side in PHP not Java, Ruby, or Node.js as in the example.
PHP Socket Create 是否相关?PHP 本身是否支持 Web Sockets?我想 PHP 实现的正确方向会有所帮助.
Is PHP Socket Create relevant? Does PHP natively support Web Sockets? I guess just a point in the right direction for PHP implementation would help.
实际上本教程有一个指向 phpwebsockets 的链接已损坏...这是应该使用的库吗?
Actually the tutorial has a broken link to phpwebsockets...is this the library one should use?
Websockets.org 有一个测试应用程序,但没有提到 PHP.
Websockets.org has a test application, but no mention of PHP.
推荐答案
就本地可用的标准 PHP WebSocket 对象而言,没有本地支持.
There isn't native support in terms of there being a standard PHP WebSocket object natively available.
您需要使用图书馆.
接下来要考虑的是 WebSocket 服务器的运行方式.通常 PHP 在 Apache、Nginx(通过 FastCGI)或 Microsoft IIS(通过 Fast CGI)上运行.对于 Apache 和 IIS,这可能是一个问题,因为它实际上并没有考虑到 WebSockets 等持久连接的构建.我不确定 Nginx.这就是为什么大多数 PHP WebSocket 库将构建为独立库以作为自己的进程运行.
The next thing to consider is how the WebSocket server runs. Normally PHP runs in Apache, Nginx (via FastCGI) or on Microsoft IIS (via Fast CGI). With Apache and IIS this may be a problem as it's not really built with persistent connections such as WebSockets in mind. I'm not sure about Nginx. This is why most PHP WebSocket libraries will be built as standalone libraries to be run as their own processes.
见:
- Apache 模块:https://github.com/disconnect/apache-websocket莉>
- 棘轮:https://github.com/cboden/Ratchet
- 扳手:https://github.com/varspool/Wrench
- PHP WebSocket:http://code.google.com/p/phpwebsocket/
注意:IE10 现已在 Windows 8 中发布
另见:Ajax推送系统
这篇关于对 Web 套接字的原生 PHP 支持是否可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)