编辑: 我想这phpwebsocket:http://www.wilky.it/Shared/phpwebsocket.zip,它工作在Firefox,但我的问题仍然存在:如何获取的WebSockets与PHP服务器的工作在Chrome 17中?“二段的WebSocket-接受”标头在Chrome缺少17
我在这里以下教程:http://net.tutsplus.com/tutorials/javascript-ajax/start-using-html5-websockets-today/
看来好像客户端连接,然后立即断开。我在控制台中发现了这个错误:
Error during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing
我在启用了php_sockets扩展的WAMP本地主机上的Chrome 17.0.963.56上试了一下。
我在某处看到Chrome已经改变了它支持的内容,但并没有深入讨论如何修复它。我希望有人能指引我完成。 (我是全新的websockets)。
服务器:
{PATH}>php startDaemon.php
2012-02-20 07:02:51 System: Socket Resource id #7 created.
2012-02-20 07:02:51 System: Socket bound to localhost:8000.
2012-02-20 07:02:51 System: Start listening on Socket.
2012-02-20 07:03:01 WebSocket: Resource id #8 CONNECTED!
2012-02-20 07:03:01 WebSocket: Requesting handshake…
2012-02-20 07:03:01 WebSocket: Handshaking…
2012-02-20 07:03:01 WebSocket: Done handshaking…
2012-02-20 07:03:01 WebSocket: Resource id #8 disconnected!
客户:
Socket Status: 0
Socket Status: 3 (Closed)
这将是有益的,如果你能打印发送接收握手和整个响应。该错误表明Accept值缺失,但很难知道没有看到握手请求和响应。我注意到你链接的服务器正在回复许多字段。 – kanaka 2012-02-22 14:37:38
我正在使用该链接的代码。我不确定你要求的是什么? – allicarn 2012-02-29 07:37:52
我要求您将代码添加到代码以打印出握手请求(来自浏览器)和响应(来自服务器)。 – kanaka 2012-02-29 14:05:39