Click here to Skip to main content
11,933,854 members (36,398 online)
Rate this:
Please Sign up or sign in to vote.
See more: Mobile Android PhoneGap
i am doing socket programming But getting error in response .
i am using this like to do socket programming[^]

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 + "'" + 
                    "}" + 
        return _d;

Here is _d print ..

(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://');
// push a message after the connection is established.
socket.onopen = function() {
    socket.send('Hello World')
// alerts message pushed from server
socket.onmessage = function(msg) {
// alert close event
socket.onclose = function() {
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.?
Posted 26-Jun-13 21:56pm
Edited 4-Jul-13 17:10pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 4 Jul 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100