我开始使用Socket.io,我做了一个快速的示例应用程序,大多数事情似乎都在起作用。但是,当我在办公室的另一台PC上测试它时,它不起作用。我无法确定问题或共同的因素。它适用于chrome和firefox中的iMac,以及运行Firefox 15.0.1的Windows机器。
然而,在其他2台机器上它不起作用,它们运行Firefox 15.0.1和最新的chrome。他们可以连接和接收广播,但他们不会发送任何广播。
随socket.io提供的示例应用程序面临同样的问题,所以我知道我的代码不是问题。
服务器是机架空间虚拟机。这些计算机都共享相同的IP地址,这会是问题吗?
感谢。
Connection I5m-GX0YxKk-fsqkaDYr accepted.
debug - emitting heartbeat for client I5m-GX0YxKk-fsqkaDYr
debug - websocket writing 2::
debug - set heartbeat timeout for client I5m-GX0YxKk-fsqkaDYr
debug - got heartbeat packet
debug - cleared heartbeat timeout for client I5m-GX0YxKk-fsqkaDYr
debug - set heartbeat interval for client I5m-GX0YxKk-fsqkaDYr
debug - client authorized
info - handshake authorized 2_OfnBCUPoO1TuWUaDYs
debug - setting request GET /socket.io/1/websocket/2_OfnBCUPoO1TuWUaDYs
debug - set heartbeat interval for client 2_OfnBCUPoO1TuWUaDYs
debug - client authorized for
debug - websocket writing 1::
Connection 2_OfnBCUPoO1TuWUaDYs accepted.
debug - setting request GET /socket.io/1/xhr-polling/2_OfnBCUPoO1TuWUaDYs?t=1347888419067
debug - setting poll timeout
debug - discarding transport
debug - cleared heartbeat interval for client 2_OfnBCUPoO1TuWUaDYs
debug - emitting heartbeat for client I5m-GX0YxKk-fsqkaDYr
debug - websocket writing 2::
debug - set heartbeat timeout for client I5m-GX0YxKk-fsqkaDYr
debug - got heartbeat packet
debug - cleared heartbeat timeout for client I5m-GX0YxKk-fsqkaDYr
debug - set heartbeat interval for client I5m-GX0YxKk-fsqkaDYr
debug - setting request GET /socket.io/1/jsonp-polling/2_OfnBCUPoO1TuWUaDYs? t=1347888429074&i=0
debug - setting poll timeout
debug - discarding transport
debug - clearing poll timeout
debug - clearing poll timeout
debug - jsonppolling writing io.j[0]("8::");
debug - set close timeout for client 2_OfnBCUPoO1TuWUaDYs
debug - jsonppolling closed due to exceeded duration
debug - emitting heartbeat for client I5m-GX0YxKk-fsqkaDYr
debug - websocket writing 2::
debug - set heartbeat timeout for client I5m-GX0YxKk-fsqkaDYr
debug - got heartbeat packet
debug - cleared heartbeat timeout for client I5m-GX0YxKk-fsqkaDYr
debug - set heartbeat interval for client I5m-GX0YxKk-fsqkaDYr
debug - setting request GET /socket.io/1/jsonp-polling/2_OfnBCUPoO1TuWUaDYs?t=1347888449506&i=0
debug - setting poll timeout
debug - discarding transport
debug - cleared close timeout for client 2_OfnBCUPoO1TuWUaDYs
^Croot@nodejs:~# node socket
info - socket.io started
debug - client authorized
info - handshake authorized R840LL5ZZes1YFB_aZS8
debug - discarding transport
debug - jsonppolling received data packet �17�3:::Hello Server!�17�3:::Hello Server!
debug - client authorized
info - handshake authorized ycWCnVfgTTLAdi0maZS9
debug - client authorized
info - handshake authorized av8ttHujRRMUNdZWaZS-
debug - setting request GET /socket.io/1/websocket/av8ttHujRRMUNdZWaZS-
debug - set heartbeat interval for client av8ttHujRRMUNdZWaZS-
debug - client authorized for
debug - websocket writing 1::
Connection av8ttHujRRMUNdZWaZS- accepted.
^Croot@nodejs:~# node socket
info - socket.io started
debug - client authorized
info - handshake authorized tod2RUk4cC6njt7_ab1d
debug - setting request GET /socket.io/1/websocket/tod2RUk4cC6njt7_ab1d
debug - set heartbeat interval for client tod2RUk4cC6njt7_ab1d
debug - client authorized for
debug - websocket writing 1::
Connection tod2RUk4cC6njt7_ab1d accepted.
debug - client authorized
info - handshake authorized Bm2b5koW4OhwMN0Uab1e
debug - setting request GET /socket.io/1/websocket/Bm2b5koW4OhwMN0Uab1e
debug - set heartbeat interval for client Bm2b5koW4OhwMN0Uab1e
debug - client authorized for
debug - websocket writing 1::
Connection Bm2b5koW4OhwMN0Uab1e accepted.
debug - setting request GET /socket.io/1/xhr-polling/Bm2b5koW4OhwMN0Uab1e?t=1347888478540
debug - setting poll timeout
debug - discarding transport
debug - cleared heartbeat interval for client Bm2b5koW4OhwMN0Uab1e
debug - emitting heartbeat for client tod2RUk4cC6njt7_ab1d
debug - websocket writing 2::
debug - set heartbeat timeout for client tod2RUk4cC6njt7_ab1d
debug - got heartbeat packet
debug - cleared heartbeat timeout for client tod2RUk4cC6njt7_ab1d
debug - set heartbeat interval for client tod2RUk4cC6njt7_ab1d
debug - setting request GET /socket.io/1/jsonp-polling/Bm2b5koW4OhwMN0Uab1e?t=1347888488546&i=0
debug - setting poll timeout
debug - discarding transport
debug - clearing poll timeout
答案 0 :(得分:0)
我部分解决了这个问题。一个反病毒程序阻止了几台机器上的Web套接字连接。我花了一段时间才发现这个问题,因为http://websocketstest.com/显示所有端口都处于打开状态,并且软件显示没有防火墙处于活动状态。但是,退出防病毒程序时,一切都开始工作了。
不知道为什么http://websocketstest.com/显示所有端口都已打开。现在切换到843端口。
由于