websocket原生平台问题

有么有遇到websocket在原生平台报错,web平台没事

服务器用的skynet,用的第三方websocket模块,https://github.com/Skycrab/skynet_websocket
客户端 是creator 用的官方例子测试的,只是ip和端口号改变了,web测试没问题,原生native都调试不通

2017-03-10T06:47:54.846Z - normal: Simulator: [WebSocket::init] _host: 192.168.2.117, _port: 8001, _path: /ws

2017-03-10T06:47:54.847Z - normal: Simulator: WebSocket thread start, helper instance: 0C451280

2017-03-10T06:47:54.847Z - normal: Simulator: NOTICE: Initial logging level 967

2017-03-10T06:47:54.847Z - normal: Simulator:

2017-03-10T06:47:54.847Z - normal: Simulator: NOTICE: Libwebsockets version: 1.6.0 unknown-build-hash

2017-03-10T06:47:54.847Z - normal: Simulator:

2017-03-10T06:47:54.848Z - normal: Simulator: NOTICE: IPV6 not compiled in

2017-03-10T06:47:54.848Z - normal: Simulator:

2017-03-10T06:47:54.848Z - normal: Simulator: NOTICE: libev support not compiled in

2017-03-10T06:47:54.848Z - normal: Simulator:

2017-03-10T06:47:54.848Z - normal: Simulator: NOTICE: mem: per-conn: 280 bytes + protocol rx buf

2017-03-10T06:47:54.848Z - normal: Simulator:

2017-03-10T06:47:54.848Z - normal: Simulator: WebSocket instance wasn’t ready…

2017-03-10T06:47:54.950Z - normal: Simulator: 下0

2017-03-10T06:47:57.209Z - normal: Simulator: Waiting WebSocket (0B58CC48) to exit!

2017-03-10T06:47:57.209Z - normal: Simulator: NOTICE: lws_context_destroy

这里有个坑,好像官方没有修复
当socket连接出现问题的时候,一定记着this.ws =null 类似这样的代码
当判断socket的状态的时候,一定要记得判断

if(this.ws && this.ws.readyState === WebSocket.OPEN){
}

我这边native平台也出现了这个问题,但是好像没有导致游戏崩溃黑屏,不清楚你的具体情况

这些判断都做了,我这边websocket在native情况下,连接不上服务器,服务器socket握手都没成功,客户端关闭

参考一下这个帖子:
http://forum.cocos.com/t/websocket/42511/8

你好,请问 我 new websocket 的时候 指定 “ws://x.x.x.x:28999” ,在webscoket init 过程中 抓包发现 http get请求 Host 字段只剩下 ip,端口消失了,请问怎么解决