Debug native. WebSocket disconnected

I follow this guide: http://www.cocos2d-x.org/docs/creator/manual/en/publish/debug-jsb.html
On the simulator and on the android I have this problem:

Windows 10 x64
Cocos Creator 2.0
Android 4.2

1 Like

Hi @hawkite

I also encountered the same problem as what you have mentioned. What I tried was forwarding port 5086 on my android device via adb command, and afterwards it worked.

You may try the following steps if it works for you:

  1. Make sure your android device is connected and USB Debugging is enabled. (Make sure the debug app is not running)
  2. open cmd/terminal, and run adb forward tcp:5086 tcp:5086
  3. (optional) You may verify if the above command work using adb forward --list
  4. run your app
  5. open chrome browser, go to chrome-devtools://devtools/bundled/inspector.html?v8only=true&ws={ip}:5086/000010002-0003-4004-8005-000600070008
    where {ip} is your phone’s ip address

Device tested:
Windows 10 x64
Cocos Creator 2.0.1
Android 4.2

Regards,
Patrick

2 Likes

Thank you. But 17 days! I got some answer after 17 days! I had many pain with Cocos. It is not good for me. I do not want to check anymore. Now I use another engine, and I am happy.

for me it still didn’t worked.

Windows 10 x64
Cocos Creator 1.9.3
Android 8.1.0

Haven’t tried with Android 8.1.0, I think it might be due to some security feature of Android 8 as I also see from other user (not Cocos but other framework) that there might be some issue with regards connecting WebSocket.

When you tried accessing the page directly from the browser, {ip}:5086, did it return a 404 error?

I’ve tried with Android 9 and cocos creator v2.1.2 and having the same issue.

Reviving this. Does anyone solved this problem?

Answering @patlo (1y later, sorry, didn’t see your message), no, it returns a connection refused page.