您好,欢迎访问一九零五行业门户网

客户端websocket 无法连接上PHP socket有关问题

客户端websocket 无法连接上php socket问题
本帖最后由 d6965921d 于 2014-07-16 10:25:53 编辑 我客户端是用c++写得websocket
客户端我请求的地址是ws://127.0.0.1:100322 (我请求ws://echo.websocket.org这个是可以的说明客户端代码是没问题的 问题就在服务端)
输出
[1405476678:7805] notice: initial logging level 7
[1405476678:7806] notice: library version: 1.3 1544a2a
[1405476678:7806] notice:  started with daemon pid 0
[1405476678:7806] notice:  static allocation: 4436 + (12 x 256 fds) = 7508 bytes
[1405476678:8329] warn: problems parsing header
php 写的socket

以下是客户端发到服务端 php socket的输出
192:socket apple$ php index.php
read client message\nreceived message:get / http/1.1
pragma: no-cache
cache-control: no-cache
host: 127.0.0.1
upgrade: websocket
connection: upgrade
sec-websocket-key: nfvpsg0kazkyrfzqkptpua==
origin: 127.0.0.1
sec-websocket-protocol: default-protocol
sec-websocket-extensions: deflate-frame
sec-websocket-version: 13
send success
------解决方案--------------------
你的php socket服务器没有完成websocket握手,建议你看下websocket 协议相关文档,或者参考下别人怎么写的,比如下面的代码包含了websocket握手及发送websocket消息
https://github.com/walkor/workerman-chat/blob/master/applications/chat/event.php
其它类似信息

推荐信息