开发者

socket.io reconnecting when connecting remotely

I copied and deployed the socket.io's demo code (found at http://socket.io/ on the front page). I have a server.js and a index.html with this demo code

When I run 'node server.js' locally, and then open index.html locally, everything works fine and I connect to the server. The ser开发者_StackOverflowver outputs:

info - handshake authorized XXXXXXXXX

However, when I put the server.js on a remote server, but open index.html locally, It keeps reconnecting. The server outputs:

info - handshake authorized XXXXXXXXX
info - handshake authorized XXXXXXXXX
info - handshake authorized XXXXXXXXX
info - handshake authorized XXXXXXXXX

and so on.

I've had a hard time finding any info on this. How am I supposed to build an application that initializes when a client connects, if it's being constantly reconnected?

This same reconnect pattern occurs when I run server.js locally, and connect to it from a remote server.

Thanks for your help!


Have you updated the url of the socket you want to connect to on the client-side?

var socket = io.connect('http://domain.com:port');

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜