My Socket.io on IOS fails to handshake with the we

2019-06-12 01:32发布

问题:

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).

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"

detail of the error:

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."}

i tried. 127.0.01, localhost... even explicit IP address.. all fail

any idea what I should check? and should it be "http" protocol ? or wss?

回答1:

Got it working.. I just cannot run a websocket server. I have to run a socket.io server... then it works.