ipad上的Websockets,还有什么需要做的吗? [英] Websockets on ipad, is there something extra that needs to be done?

查看:207
本文介绍了ipad上的Websockets,还有什么需要做的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将websockets用于项目。它需要使用ipad,虽然我似乎无法使其工作。

Im attempting to use websockets for a project. It needs to use the ipad, though i cant seem to make it work.

我已下载此代码的副本,该代码使用phpwebsocket http://www.flynsarmy.com/2012/02/php-websocket-chat-application-2-0/ 。然后设置服务器。我让它在计算机,不同的浏览器上工作,没问题。

I have downloaded a copy of this code that uses phpwebsocket http://www.flynsarmy.com/2012/02/php-websocket-chat-application-2-0/ . Followed setting up the server. I got it working across computers, different browsers, no problem.

然后我想在我的ipad(ios 5.1)上测试它,它不会工作。所以我确保websockets在ipad上工作,我发现他们确实[link] http://websocket.org/echo.html。

Then i wanted to test it on my ipad (ios 5.1) and it wouldnt work. So i made sure that websockets worked on ipad, which i found they did [link]http://websocket.org/echo.html .

然后我进一步查看,看到它正在尝试连接,但是在大约15秒后断开连接,我假设超时。它显示在我的Mac上的终端中,表示它已断开连接。

I then looked at it further, to see it was attempting to connect, but then disconnecting after about 15 seconds, i assume timing out. It shows up in terminal on my mac, saying it has disconnected.

我目前通过wifi将我的ipad连接到我的mac,看看它是否是路由器,并且终端IP地址显示不同,以255.255.255.100结尾而不是255.255.255.96

I am currently connecting my ipad to my mac over wifi to see if it was the router, and in terminal IP address shows differently, ending in 255.255.255.100 not 255.255.255.96

有没有人知道发生了什么,或者我应该怎么做才能对它进行排序。

Does anyone have any ideas what is going on, or what i should do to sort it.

推荐答案

多么糟糕。在该页面项目源,Flynsarmy表示他正在使用 PHPWebSocket 实际上他正在使用 PHP的WebSocket的服务器。 (我已经提交了一条评论,表明他的页面上有错误。)

What a mess. On that page and in the project source, Flynsarmy indicates that he is using PHPWebSocket while in fact he is using php-websocket-server. (I have submitted a comment indicating the mistake on his page).

这两个PHP WebSocket项目完全不同:

Those two PHP WebSocket projects are quite different:


  • PHPWebSocket 是一个相对较旧且未维护的项目,仅限于支持旧的Hixie(原型)版本的WebSocket协议。

  • php-websocket-server 是一个较新但不太知名的项目,只支持较新的HyBi / IETF(标准)版协议。

  • PHPWebSocket is a relatively old and unmaintained project that only supports the older Hixie (prototype) version of the WebSocket protocol.
  • php-websocket-server is a newer but less well known project that only supports the newer HyBi/IETF (standard) version of the protocol.

你的问题是:Safari桌面和iOS目前支持协议的较旧的Hixie 版本,该版本不适用于基于php-websocket-server的任何项目。

Your problem is this: Safari Desktop and iOS currently supports the older Hixie version of the protocol which will not work with any project based on php-websocket-server.

制作支持旧版和新版协议的WebSocket服务器相当容易(而且大多数语言都有实现)可以从初始握手标头中检测客户端/浏览器版本。但是由于某些原因,缺少支持这两种服务器的基于PHP的服务器。

It is fairly easy to make WebSocket servers that support both the old and new versions of the protocol (and most languages have implementations that do) since it the client/browser version can be detected from the initial handshake headers. However for some reason there is a lack of PHP based servers that support both.

这篇关于ipad上的Websockets,还有什么需要做的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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