Hi
i am doing socket programming But getting error in response .
i am using this like to do socket programming
http://anismiles.wordpress.com/2011/02/03/websocket-support-in-android%E2%80%99s-phonegap-apps/[
^]
But when i debug my program i am getting all data in my .java file in that method.
private String buildLoadData(String _event, String _data) {
String _d = "javascript:WebSocket.on" + _event + "(" +
"{"
+ "\"_target\":\"" + webSocketId + "\"," +
"\"_data\":'" + data + "'" +
"}" +
")";
Logger.log(_d);
return _d;
}
Here is _d print ..
WebSocket.onmessage({"_target":"WEBSOCKET.54","data":'!!20W)0
(Note: In open court at !#10W*.)0
THE COURT: !$10W*I\'m !%10W+going !&10W+to !\'10W+re!(10W,serve !)10W,counsel !*10W,'})
---------------------------------
But from Html where i need data to show i call this java method.But i am getting only this result
var socket = new WebSocket('ws://192.168.1.3:8101/');
socket.onopen = function() {
socket.send('Hello World')
};
socket.onmessage = function(msg) {
$(".test_h").val(JSON.stringify(msg)).keyup();
console.log("TTTTT"+JSON.stringify(msg));
};
socket.onclose = function() {
alert('closed');
};
In console i am getting this,....
06-27 11:04:36.156: I/Web Console(924): TTTTT{"_target":"WEBSOCKET.54","data":"!!2"} at file:///android_asset/www/index.html:52
then after i am getting like this
06-27 10:53:25.136: D/CordovaLog(871): Uncaught SyntaxError: Unexpected token ILLEGAL
Uncaught SyntaxError: Unexpected token ILLEGAL at null:1
it is printed again and again this message
Uncaught SyntaxError: Unexpected token ILLEGAL at null:1
?How to remove this error.?