Looking for Hello World Type Example of Web Sockets Implementation:
查找Web Sockets实现的Hello World类型示例:
Here is Socket Create reference from php.net but this looks more low level than Web Sockets.
这里是来自php.net的套接字创建引用,但是这看起来比Web套接字要低。
I want to use this Web Sockets as shown here on caniuse.com which is now implemented in all new major browsers.
我想使用caniuse.com上的这个Web套接字,它现在在所有新的主要浏览器中都实现了。
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.
一个谷歌搜索打开了这个网。TutsPlus站点,我可以在其中使用JavaScript示例代码……但是我需要知道如何用PHP而不是Java、Ruby或Node实现服务器端。如示例中所示。
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.
PHP套接字是否具有相关性?PHP是否支持Web套接字?我想只要在PHP实现的正确方向上指出一点就会有所帮助。
Actually the tutorial has a broken link to phpwebsockets...is this the library one should use?
实际上,本教程的phpwebsockets链接被破坏了……这是图书馆吗?
Websockets.org has a test application, but no mention of PHP.
org有一个测试应用程序,但是没有提到PHP。
1 个解决方案
#1
45
There isn't native support in terms of there being a standard PHP WebSocket object natively available.
对于本地可用的标准PHP WebSocket对象,不存在本地支持。
You'll need to use a library.
你需要使用图书馆。
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.
接下来要考虑的是WebSocket服务器如何运行。PHP通常在Apache、Nginx(通过FastCGI)或Microsoft IIS(通过快速CGI)中运行。对于Apache和IIS来说,这可能是一个问题,因为它并不是在脑海中构建持久连接,比如WebSockets。我对Nginx不太确定。这就是为什么大多数PHP WebSocket库将作为独立库构建,并作为它们自己的进程运行。
See:
看到的:
- Apache Module: https://github.com/disconnect/apache-websocket
- Apache模块:https://github.com/disconnect/apache-websocket
- Ratchet: https://github.com/cboden/Ratchet
- 棘轮:https://github.com/cboden/Ratchet
- Wrench: https://github.com/varspool/Wrench
- 扳手:https://github.com/varspool/Wrench
- PHP WebSocket: http://code.google.com/p/phpwebsocket/
- PHP WebSocket:http://code.google.com/p/phpwebsocket/
Note: IE10 is now released in Windows 8
注意:IE10现在已经在Windows 8中发布
Also see: Ajax push system
参见:Ajax推送系统
#1
45
There isn't native support in terms of there being a standard PHP WebSocket object natively available.
对于本地可用的标准PHP WebSocket对象,不存在本地支持。
You'll need to use a library.
你需要使用图书馆。
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.
接下来要考虑的是WebSocket服务器如何运行。PHP通常在Apache、Nginx(通过FastCGI)或Microsoft IIS(通过快速CGI)中运行。对于Apache和IIS来说,这可能是一个问题,因为它并不是在脑海中构建持久连接,比如WebSockets。我对Nginx不太确定。这就是为什么大多数PHP WebSocket库将作为独立库构建,并作为它们自己的进程运行。
See:
看到的:
- Apache Module: https://github.com/disconnect/apache-websocket
- Apache模块:https://github.com/disconnect/apache-websocket
- Ratchet: https://github.com/cboden/Ratchet
- 棘轮:https://github.com/cboden/Ratchet
- Wrench: https://github.com/varspool/Wrench
- 扳手:https://github.com/varspool/Wrench
- PHP WebSocket: http://code.google.com/p/phpwebsocket/
- PHP WebSocket:http://code.google.com/p/phpwebsocket/
Note: IE10 is now released in Windows 8
注意:IE10现在已经在Windows 8中发布
Also see: Ajax push system
参见:Ajax推送系统