代码是官方文档给的例子:
下面是日志:
Simulator: listen:
Simulator: debugger: none
Simulator: add searching path:
Simulator:
3
Simulator: ------------------------------------------------
Simulator: LOAD Js FILE: main.js
Simulator: ------------------------------------------------
Simulator: Cocos2d-JS v3.14
Simulator: iShow!
Simulator: 加载事件!
Simulator: [WebSocket::init] _host: 172.17.134.27, _port: 9092, _path: /
Simulator: WebSocket thread start, helper instance: 0877C678
Simulator: NOTICE: Initial logging level 967
Simulator:
Simulator: NOTICE: Libwebsockets version: 1.6.0 unknown-build-hash
Simulator:
Simulator: NOTICE: IPV6 not compiled in
Simulator:
Simulator: NOTICE: libev support not compiled in
Simulator:
Simulator: WebSocket (087C7490) onConnectionError …
Simulator: NOTICE: mem: per-conn: 280 bytes + protocol rx buf
Simulator:
Simulator: Ready state is closing or was closed, code=2, quit websocket thread!
Simulator: NOTICE: lws_context_destroy
Simulator:
Simulator: WebSocket (087C7730) onConnectionClosed …
Simulator: WebSocket thread exit, helper instance: 0877C678
Simulator: 错误error
Simulator: 连接已经关闭
Simulator: In the destructor of WebSocket (087C7730)
Simulator: jsb: ERROR: File …\manual\network\jsb_websocket.cpp: Line: 397, Function: js_cocos2dx_extension_WebSocket_get_readyState
Simulator: Invalid Native Object
Simulator: 30:Error: Invalid Native Object
Simulator:
Simulator: jsb: ERROR: File …\manual\network\jsb_websocket.cpp: Line: 397, Function: js_cocos2dx_extension_WebSocket_get_readyState
Simulator: Invalid Native Object
Simulator: 30:Error: Invalid Native Object
这问题貌似不止我一个人遇到,网上也找不到答案,群里也没人回复,焦灼ing…