且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

对 Web 套接字的原生 PHP 支持是否可用?

更新时间:2022-02-14 08:10:36

就本地可用的标准 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.

见:

注意:IE10 现已在 Windows 8 中发布

另见:Ajax推送系统