我在 IOS 上的 Socket.io 无法与 websocket 服务器握手 [英] My Socket.io on IOS fails to handshake with the websocket server
问题描述
我有一个运行 Websocket 的 Node.js 服务器.(使用柚子).我能够运行一个 Web 应用程序并连接到它(localhost @port 3104).
I have a Node.js server running Websocket. (using Pomelo). I am able to run a web application and connect to it (localhost @port 3104).
但是,当我尝试将 socket.io (SocketRocket) 用于 IOS 并连接到相同的本地主机和端口时,我收到此错误:
however, when I try to use socket.io (SocketRocket) for IOS and connect to the same localhost and port, I get this error:
> http://127.0.0.1:3014/socket.io/1/?t=16807
> "ERROR: handshake failed ... The request timed out"
错误详情:
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x6c723c0
{NSErrorFailingURLStringKey=http://127.0.0.1:3014/socket.io/1/?t=16807, NSErrorFailingURLKey=http://127.0.0.1:3014/socket.io/1/?t=16807, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x6c72400 "The request timed out."}
我试过了.127.0.01, localhost...即使是显式IP地址...都失败
i tried. 127.0.01, localhost... even explicit IP address.. all fail
知道我应该检查什么吗?它应该是http"协议吗?还是 wss?
any idea what I should check? and should it be "http" protocol ? or wss?
推荐答案
开始工作了.. 我就是无法运行 websocket 服务器.我必须运行 socket.io 服务器……然后它就可以工作了.
Got it working.. I just cannot run a websocket server. I have to run a socket.io server... then it works.
这篇关于我在 IOS 上的 Socket.io 无法与 websocket 服务器握手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!