在Socket.io中使用PHP [英] Using PHP with Socket.io

查看:100
本文介绍了在Socket.io中使用PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在客户端使用Sockets.io并与服务器上基于PHP的应用程序进行通信? PHP甚至支持这种长寿命连接"代码编写方式吗?

Is it possible to use Sockets.io on the client side and communicate with a PHP based application on the server? Does PHP even support such a 'long-lived connection' way of writing code?

我为socket.io找到的所有示例代码似乎都是针对服务器端的node.js,因此没有帮助.

All the sample code I find for socket.io seems to be for node.js on the server side, so no help there.

推荐答案

要回答这个问题可能有点晚了,但这是我的发现.

It may be a little late for this question to be answered, but here is what I found.

我不想就节点的性能优于或不优于php进行辩论,这不是重点.

I don't want to debate on the fact that nodes does that better than php or not, this is not the point.

解决方案是:我尚未找到用于PHP的socket.io的任何实现.

The solution is : I haven't found any implementation of socket.io for PHP.

但是有一些方法可以实现 WebSockets .有此jQuery插件,可让您使用Websocket并优雅地将其降级​​为非支持浏览器.在PHP方面,有此类,它似乎是PHP WS中使用最广泛的服务器.

But there are some ways to implement WebSockets. There is this jQuery plugin allowing you to use Websockets while gracefully degrading for non-supporting browsers. On the PHP side, there is this class which seems to be the most widely used for PHP WS servers.

这篇关于在Socket.io中使用PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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