我从这篇文章中下载了这个WebSocket示例:
我按照说法正确地做了一切,但是我得到了一些错误,比如"只有变量可以通过......"
我更改了这一行:
$num_sockets = socket_select($changed_sockets,$write=NULL,$exceptions=NULL,NULL);
......对此:
$write=NULL;
$exceptions=NULL;
$num_sockets = socket_select($changed_sockets,$write,$exceptions,0);
...并且错误消失了,但现在它只是连接然后像这样断开连接并且什么都不做:
2014-01-04 17:02:39 WebSocket: Resource id #9 CONNECTED!
2014-01-04 17:02:39 WebSocket: Requesting handshake...
2014-01-04 17:02:39 WebSocket: Handshaking...
2014-01-04 17:02:39 WebSocket: Done handshaking...
2014-01-04 17:02:39 WebSocket: Resource id #9 disconnected!