Click here to Skip to main content
13,044,428 members (127,301 online)
Rate this:
Please Sign up or sign in to vote.
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 20:56pm
Updated 4-Jul-13 16: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
Web02 | 2.8.170713.1 | Last Updated 4 Jul 2013
Copyright © CodeProject, 1999-2017
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