6 Replies Latest reply on Dec 22, 2017 12:37 PM by christophs1004254

    socket.io with phonegap build for android does not work?


      I have an html5/javascript app that uses socket.io and it works just fine on the browser but when compile in Phonegap Build for Android socket.io does not connect when executing socket = io.connect([server]:[port]).

      I've already tried a lot of possible solutions, none of them worked out. This is what I've tried already:

      • using IP instead of full domain when connecting to socket.io
      • socket.io connection done after ondeviceready event is triggered
      • plugin cordova-plugin-whitelist in config.xml
      • plugin https://github.com/mkuklis/phonegap-websocket in config.xml
      • tried to use cordova-plugin-crosswalk-webview in config.xml but Phonegap Build just does not go through with the compilation process and throws an error
      • access origin="*" in config.xml
      • io.set('origins', ':') in server code
      • different socket.io transports (websockets, polling, etc)

      I am using Phonegap's latest version 6.5.0 (Phonegap Build does not allow me to use a previous version like 6.4.5).

      Whatever I do socket.on("connect", function() { alert(socket.id) }) is never triggered on Android. On web, however, it alerts with the proper socket.id.

      Also, I tried to check out log with DEBUG=* node server.js and nothing appears when using Android version.