mkuklis / phonegap-websocket

Websocket PhoneGap plugin for Android
203 stars 75 forks source link

socket.on('error') is fired from cordova android application #42

Closed venca163 closed 10 years ago

venca163 commented 10 years ago

Hello,

I am trying to get it work for many days and I run out of ideas. I am still getting the socket.on('error', function (e) {...}). (If I try to log the 'e', it gives me nothing.) I am using cordova version 3.4.1, android version 4.1.2., windows vista.

I am using exactly your code, I have only changed the line with IP of my server to this: var socket = io.connect("http://10.0.0.6:8080"); I have tested server from browser client and it is working (message "Hello from server 1397639242411" appears).

I have also tryed to change access tag in config.xml from <access origin="*" /> to <access origin="http://10.0.0.6" />, or to keep both. No effect.

Plugin was installed using "cordova plugin add https://github.com/mkuklis/phonegap-websocket" with no errors. Is this really the only thing what needs to be done to start using the plugin? I cannot find anywhere in code that the plugin is accessed, socket.io.js is loaded from www/js/socket.io.js.

If you have any idea or suggestions where could be the problem, please tell me. I would really appreciate it. Thank you!

venca163 commented 10 years ago

Problem is solved, it was my fault, sorry. There was some problem with connection to localhost on my side.

For further readers, "cordova plugin add https://github.com/mkuklis/phonegap-websocket" is really the only thing needed to get it work. Default value <access origin="*" /> in projectfolder/config.xml is sufficient. Tested on actual cordova version 3.4.1-0.1.0