Nakama WebSocket throws error when built in native

Hi,

I’m using Cocos creator 2.4.6 and is using the nakama for WebSocket connection
when it’s built for web platform it works fine, but when the same is built for native, it throws following error.

2021-08-09 12:26:36.457 14674-14674/com.fbnakama.cocos I/AssistStructure: Flattened final assist data: 588 bytes, containing 1 windows, 3 views
2021-08-09 12:26:41.087 14674-14732/com.fbnakama.cocos D/jswrapper: XMLHttpRequest.withCredentials isn't implemented on JSB!
2021-08-09 12:26:41.096 14674-14732/com.fbnakama.cocos D/cocos2d-x: In the constructor of HttpClient!
2021-08-09 12:26:41.200 14674-14783/com.fbnakama.cocos D/JniHelper: JniHelper::getJavaVM(), pthread_self() = -1273839168
2021-08-09 12:26:41.227 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: WebSocket thread start, helper instance: 0xc8bbcb00
2021-08-09 12:26:41.230 14674-14732/com.fbnakama.cocos D/jswrapper: JS:  auth success
2021-08-09 12:26:41.236 14674-14732/com.fbnakama.cocos D/jswrapper: JS: state : auth success
2021-08-09 12:26:41.238 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: NOTICE: Creating Vhost 'default' port -1, 1 protocols, IPv6 on
2021-08-09 12:26:41.238 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: NOTICE: created client ssl context for default
2021-08-09 12:26:41.239 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: NOTICE: lws_client_connect_2: 0xb6a1b600: address 34.93.110.203
2021-08-09 12:26:41.239 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: NOTICE: uplevelling AF_INET to AF_INET6
2021-08-09 12:26:41.239 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: WebSocket (0xc8bbdd00) Unhandled websocket event: 32
2021-08-09 12:26:41.239 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: WebSocket (0xc8bbdd00) Unhandled websocket event: 29
2021-08-09 12:26:41.256 14674-14732/com.fbnakama.cocos D/jswrapper: JS: LoadScene match: 19.468000000000757ms
2021-08-09 12:26:41.257 14674-14732/com.fbnakama.cocos D/jswrapper: JS: InitScene: 0.9369999999998981ms
2021-08-09 12:26:41.258 14674-14732/com.fbnakama.cocos D/jswrapper: JS: AttachPersist: 0.42299999999886495ms
2021-08-09 12:26:41.259 14674-14732/com.fbnakama.cocos D/jswrapper: JS: AutoRelease: 0.4750000000003638ms
2021-08-09 12:26:41.271 14674-14732/com.fbnakama.cocos D/jswrapper: JS: Destroy: 11.912999999998647ms
2021-08-09 12:26:41.277 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: NOTICE: lws_client_connect_2: 0xb6a1b600: address 34.93.110.203
2021-08-09 12:26:41.277 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: NOTICE: uplevelling AF_INET to AF_INET6
2021-08-09 12:26:41.278 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: WebSocket (0xc8bbdd00) Unhandled websocket event: 24
2021-08-09 12:26:41.316 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: WebSocket (0xc8bbdd00) Unhandled websocket event: 2
2021-08-09 12:26:41.316 14674-14785/com.fbnakama.cocos D/WebSocket.cpp: onConnectionOpened...: 0xc8bbdd00, client protocols: , server selected protocol: 
2021-08-09 12:26:41.363 14674-14732/com.fbnakama.cocos D/jswrapper: JS: Activate: 91.09900000000016ms
2021-08-09 12:26:41.367 14674-14732/com.fbnakama.cocos D/jswrapper: JS: connected
2021-08-09 12:26:48.116 14674-14732/com.fbnakama.cocos D/debug info: Uncaught Exception:
     - location :  
     - msg : rejectAfterPromiseResolved
     - detail : 
          Request timed out.
    stacktrace: 
2021-08-09 12:26:48.116 14674-14732/com.fbnakama.cocos D/jswrapper: JS: [ERROR]:  rejectAfterPromiseResolved Request timed out.
    stacktrace: 

Hey @d3stryr :wave:

What version of our cocos client are you using?

This issue was fixed in the latest release: Release v2.1.0 · heroiclabs/nakama-cocos2d-x-javascript · GitHub

1 Like