mkuklis / phonegap-websocket

Websocket PhoneGap plugin for Android
203 stars 78 forks source link

Echo test packaged with build.phonegap.com not working #46

Closed marcosabatini closed 10 years ago

marcosabatini commented 10 years ago

Hi, thanks for your plugin. I'm trying to test it through build.phonegap.com (phonegap 3.3.0) and his interface, and I picked the one suggested in the official plugins list, the 0.1.0, and also tried to omit the version to always get the latest version. I prepared a mini app including the code suggested in http://www.websocket.org/echo.html in an index.html and a simple config.xml to include your plugin, but the downloaded app doesn't work in a bluestack emulator and in a nexus with 4.3 Android. As it is a very basic test, I thought this issue could have happened to other people, but I saw nothing similar on the web. Am I doing something wrong? Thank you

PS: adding this:

    var supportsWebSockets = function() {
        if ('WebSocket' in window) {
            if (WebSocket.hasOwnProperty('onopen'))
                return true;
            else
                return false;
        } else {
            return false;
        }
    }

I can see that the function returns true. Isn't it weird?

marcosabatini commented 10 years ago

Sorry, my fault, I made a big mistake: I didn't read that I had to put a reference in index.html to phonegap.js... pretty basic, but not for me: I didn't start from the "getting started guide" and I didn't installed cordova and created the app via CLI... so my index.html was hand made... stupid me :) So if there is someone else not too smart and you want to use only the phonegap build, please start from http://docs.build.phonegap.com/en_US/introduction_getting_started.md.html#Getting%20Started%20with%20Build Bye

marcosabatini commented 10 years ago

PS: all is working perfectly, thank you very very much Update: actually ws:// makes connection but doesn't catch responses, only wss:// connections work correctly in Android (tested a 4.3)