2017-06-06 70 views
0

有沒有人使用cocos2d js與深流io?Cocos2d js(Cocos2d x 3.14)在深度流io

我試圖用deepstream客戶端的js,但它似乎是失敗時嘗試服務器通過網絡(的WebSocket)連接:

這是亞行對數:

06-06 09:43:19.227: D/cocos2d-x debug info(26288): connectDeepStream [object Object] [email protected]/src/modules/Actions/Player.js:22:13,

06-06 09:43:19.232: D/WebSocket.cpp(26288): WebSocket thread start, helper instance: 0x97987760

06-06 09:43:19.237: D/WebSocket.cpp(26288): NOTICE: Initial logging level 911

06-06 09:43:19.237: D/WebSocket.cpp(26288): NOTICE: Libwebsockets version: 2.1.0 [email protected]

06-06 09:43:19.237: D/WebSocket.cpp(26288): NOTICE: IPV6 compiled in and enabled

06-06 09:43:19.237: D/WebSocket.cpp(26288): NOTICE: libev support not compiled in

06-06 09:43:19.237: D/WebSocket.cpp(26288): NOTICE: libuv support not compiled in

06-06 09:43:19.237: D/WebSocket.cpp(26288): NOTICE: Threads: 1 each 1024 fds

06-06 09:43:19.237: D/WebSocket.cpp(26288): NOTICE: mem: platform fd map: 4096 bytes

06-06 09:43:19.237: D/WebSocket.cpp(26288): NOTICE: Compiled with OpenSSL support

06-06 09:43:19.247: D/WebSocket.cpp(26288): NOTICE: mem: per-conn:
376 bytes + protocol rx buf

06-06 09:43:19.247: D/WebSocket.cpp(26288): protocol: ws, host: ...*, port: 3512, path: deepstream

06-06 09:43:19.247: D/WebSocket.cpp(26288): NOTICE: Creating Vhost 'default' port -1, 1 protocols, IPv6 on

06-06 09:43:19.252: D/WebSocket.cpp(26288): NOTICE: lws_protocol_init

06-06 09:43:19.252: D/WebSocket.cpp(26288): WebSocket (0xae824ed0) Unhandled websocket event: 32

06-06 09:43:19.252: D/WebSocket.cpp(26288): WebSocket (0xae824ed0) Unhandled websocket event: 29

06-06 09:43:19.257: D/WebSocket.cpp(26288): WebSocket (0xae824ed0) Unhandled websocket event: 24

06-06 09:43:19.267: D/WebSocket.cpp(26288): WebSocket (0xae824ed0) onConnectionError, state: 0 ...

06-06 09:43:19.267: D/WebSocket.cpp(26288): WebSocket (0xae824ed0) onConnectionClosed, state: 2 ...

06-06 09:43:19.267: D/WebSocket.cpp(26288): onConnectionClosed, WebSocket (0xae824ed0) is closing by server.

06-06 09:43:19.267: D/WebSocket.cpp(26288): WebSocket (0xae824ed0) onConnectionClosed DONE!

06-06 09:43:19.267: D/WebSocket.cpp(26288): WebSocket (0xae824ed0) Unhandled websocket event: 45

06-06 09:43:19.267: D/WebSocket.cpp(26288): WebSocket (0xae824ed0) Unhandled websocket event: 33

06-06 09:43:19.267: D/WebSocket.cpp(26288): WebSocket (0xae824ed0) onConnectionClosed, state: 3 ...

06-06 09:43:19.282: D/cocos2d-x debug info(26288): _onError [object Object] object

06-06 09:43:19.282: D/cocos2d-x debug info(26288): [object Object]

06-06 09:43:19.282: D/cocos2d-x debug info(26288): {"type":"error"}

06-06 09:43:19.287: D/WebSocket.cpp(26288): In the destructor of WebSocket (0xae824ed0)

06-06 09:43:19.287: D/WebSocket.cpp(26288): before join ws thread

06-06 09:43:19.292: D/WebSocket.cpp(26288): NOTICE: lws_context_destroy

06-06 09:43:19.292: D/WebSocket.cpp(26288): WebSocket thread exit, helper instance: 0x97987760

06-06 09:43:19.292: D/WebSocket.cpp(26288): after join ws thread

06-06 09:43:19.317: D/cocos2d-x debug info(26288): C connectionError [object Object] string

06-06 09:43:19.317: D/cocos2d-x debug info(26288): error: string

06-06 09:43:19.317: D/cocos2d-x debug info(26288): [object Object]

06-06 09:43:19.317: D/cocos2d-x debug info(26288): connectionError

06-06 09:43:19.317: D/cocos2d-x debug info(26288): C

我試圖登錄的內容錯誤,但它只是「{」type「:」error「}」。

代碼太簡單了。我只啓動一個deepstream服務器,並嘗試登錄到Android客戶端在服務器上(JS的cocos2d-JS)

這樣的:

this.client = deepstream(CCDefine.DeepStreamServer).login({username: arg.username, password: arg.password},function(success,data){ 


cc.log(success,data) 

     if(success){ 
      cc.log('Deep stream connect success') 

     }else{ 
      cc.log('Deep stream connect false') 
     } 
    }) 

我發現,沒有libuv科科斯使用libwebsockets而deepstream使用。可以解決問題嗎?我試圖用libuv爲android編譯libwebsockets,但是我失敗了。

回答

0

很難說出問題在這裏,但它看起來像WebSocket API可能不兼容。 您可以嘗試在深流錯誤處理程序中記錄錯誤對象的內容嗎?如果你可以發佈一個很好的小代碼示例。