anismiles/websocket-android-phonegap

websocketjs needs a getter property for readyState

Opened this issue · 0 comments

When I use jWebSocket on phonegap, it checks for readyState as a property and errors when notdefined gets returned.

        if( this.fConn.readyState == jws.OPEN ) {
            this.fConn.close();
        }

Here, this.fConn is the WebSocket defined in websocket.js

I placed the following prototype addition in my copy of the js file to fix the issue:

WebSocket.prototype.__defineGetter__("readyState", function(){
            return this.socket.getReadyState();
        })

This should be placed in the project as well.