**
cocos creator版本1.5.2,服务器用的是node.js。浏览器中socket.io连接正常,到了原生平台就不行了。打印如下:
**
2017-07-31 10:36:33.820 Lobby-mobile[798:14929] Starting to load http://yyrcapp.laolongtang.cc:10000/socket.io/1/?EIO=2&transport=polling&b64=true
2017-07-31 10:36:33.880 Lobby-mobile[798:14929] Received response from request to url http://yyrcapp.laolongtang.cc:10000/socket.io/1/?EIO=2&transport=polling&b64=true
D/WebSocket.cpp (415): WebSocket thread start, helper instance: 0x6080002abac0
D/WebSocket.cpp (167): NOTICE: Initial logging level 911
D/WebSocket.cpp (167): NOTICE: Libwebsockets version: 2.1.0 james@James-Chen.local-v3.4-139-gbdcf7f8
D/WebSocket.cpp (167): NOTICE: IPV6 compiled in and enabled
D/WebSocket.cpp (167): NOTICE: libev support not compiled in
D/WebSocket.cpp (167): NOTICE: libuv support not compiled in
D/WebSocket.cpp (167): NOTICE: Threads: 1 each 7168 fds
D/WebSocket.cpp (167): NOTICE: mem: platform fd map: 57344 bytes
D/WebSocket.cpp (167): NOTICE: Compiled with OpenSSL support
objc[798]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x12c32acc0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x12c1416f0). One of the two will be used. Which one is undefined.
D/WebSocket.cpp (167): NOTICE: mem: per-conn: 512 bytes + protocol rx buf
D/WebSocket.cpp (873): scheme: ws, host: yyrcapp.laolongtang.cc, port: 10000, path: /socket.io/1/websocket/97
D/WebSocket.cpp (167): NOTICE: Creating Vhost ‘default’ port -1, 1 protocols, IPv6 on
D/WebSocket.cpp (167): NOTICE: lws_protocol_init
D/WebSocket.cpp (1322): WebSocket (0x7fcae1629c50) Unhandled websocket event: 32
D/WebSocket.cpp (1322): WebSocket (0x7fcae1629c50) Unhandled websocket event: 29
D/WebSocket.cpp (1322): WebSocket (0x7fcae1629c50) Unhandled websocket event: 24
D/WebSocket.cpp (1197): WebSocket (0x7fcae1629c50) onConnectionError, state: 0 …
D/WebSocket.cpp (1226): WebSocket (0x7fcae1629c50) onConnectionClosed, state: 2 …
D/WebSocket.cpp (1256): onConnectionClosed, WebSocket (0x7fcae1629c50) is closing by server.
D/WebSocket.cpp (1279): WebSocket (0x7fcae1629c50) onConnectionClosed DONE!
D/WebSocket.cpp (1322): WebSocket (0x7fcae1629c50) Unhandled websocket event: 45
D/WebSocket.cpp (1322): WebSocket (0x7fcae1629c50) Unhandled websocket event: 33
D/WebSocket.cpp (1226): WebSocket (0x7fcae1629c50) onConnectionClosed, state: 3 …
Websocket error received: 1
JSB SocketIO::SIODelegate->onClose method called from native
JSB SocketIO::SIODelegate->fireEventToScript method called from native with name ‘disconnect’ data:
disconnect: null
close!
disconnect: undefined
D/WebSocket.cpp (545): In the destructor of WebSocket (0x7fcae1629c50)
D/WebSocket.cpp (565): before join ws thread
D/WebSocket.cpp (167): NOTICE: lws_context_destroy
D/WebSocket.cpp (425): WebSocket thread exit, helper instance: 0x6080002abac0
D/WebSocket.cpp (567): after join ws thread