anismiles/websocket-android-phonegap — Issue #7: websocketjs needs a getter property for readyState
Author: IslandRa
Created: 2011-10-09 04:31:37+00:00
State: open

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 websocke.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.