JSON.parse problem in construct2-r103.2-setup_3404

0 favourites
  • 1 posts
  • "Javascript error!

    SyntaxError: JSON.parse: unexpected character

    localhost/My_plugin.js, line 134"

    -------------------------------------------------

    I develop my Own plugin to connect my Gamer to server via webSocket. Everything working very smooth and stable in r95. But runtime err appear after I upgrade to r103.2.3404349. I did try the test but could not define problem. For example: If I write only JSON testing with bellow JavaScript code, it is working ok:

    <font color=blue>var _data = '{"firstName":"John" , "lastName":"Doe"}';

    var obj = JSON.parse(_data);                     

    alert(obj.firstName);</font>

    Once connect to my webSocket server, bellow message popup:

    <font color=red>"Javascript error!

    SyntaxError: JSON.parse: unexpected character localhost/My_plugin.js, line 134"</font>

    But actually with R95 - this problem never happen.

    My server using windown2003 and websocket server base on Fleck at:

    github.com/statianzo/Fleck

    Please help me..I don't wanna stay slickly in R95 forever...:(.

    Best regard..

    PS: the declaration of websocket in my own plug in like that

    <font color=blue>

    if(typeof(WebSocket) == "undefined" && typeof(MozWebSocket) == "undefined")

    return;

    var socket = this.socket;

    wsImpl = window.WebSocket || window.MozWebSocket;</font>

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)