xseano / xQube

Boilerplate for realtime 3D rendering and server-side physics in HTML5 and NodeJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected end of JSON input

IceAquaria opened this issue · comments

For some reason, when I run server.sh on Windows 10, I'm getting SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at exports.XMLHttpRequest.xhttp.onreadystatechange (Location:\BLAH\xampp\htdocs\BLAH\BLAH\xQube\server\src\index.js:8:29)

Can you PLEASE tell me how to run the server correctly?

Thank You!

commented

Your webserver should be running the /web/ at root level so you're configuration file would be live at (Line 4) http://127.0.0.1/conf/conf.json or http://localhost/conf/conf.json. Line 8 is meant to parse the settings stored in JSON configuration file.

Let me know if you get it working and if you need additional help.

P.S. I am planning to fully rewrite this whole codebase soon, it is very messy and poorly designed.

i still can't get it working. It's still got the same error... :(

Do you have instructions on how to get past this error? Thank You!

Are you there brother? I need help getting this working plz & thank you!

commented

Where, on your webserver, is the conf/conf.json located?

D:\D_DRIVE_STUFF\xampp\htdocs\LiveLessons\Three.js\xQube\web\conf\conf.json

commented

At what URL do you use to access the home page on your local machine? It would be something like http://localhost/LiveLessons\Three.js\xQube\web\index.php or something similar.

I use a xampp server so localhost/LiveLessons/Three.js/xQube/web would be correct.

Any luck? Thanks bro! :)

commented

Try changing line 4 to http://localhost/LiveLessons/Three.js/xQube/web/conf/conf.json

awesome! it worked! thanks much! Can you please tell me how to add alpha to my player? as in the part of the server where it says ".r", ".g", ".b" I'd like to add ".a" I tried it & I get an error that says: "new RangeError index out of range" in buffer.js.

Thanks alot buddy! :)

commented

You'd need to write the alpha value here like this

msg.setUint8(offset, colorObj.a, true);
offset++;

Then have it read here like this

var a = reader.readUInt8();
...
var rgb = ('rgb(' + r + ',' + g + ',' + b + ',' + a + ')');
...
this.cubeID.a = a;

As far as I know, the existing color library utilized in the source doesn't support RGBA. It supports RGB and hex color values, parsed here.

utils.js?v=bc754b80:200 Uncaught RangeError: Offset is outside the bounds of the DataView
at DataView.setUint8 ()
at Utils.sendColor (utils.js?v=bc754b80:200)
at Player.create (player.js?v=56bf5962:66)
at Network.createClient (network.js?v=8c76ef7d:320)
at Network.onMessage (network.js?v=8c76ef7d:186)

Any luck brother? Thanks a TON! <3

commented

You'd have to work on this implementation in more detail, I was just providing basic syntax usage.