You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a bit unsure of how to make calls to the JSON Api on my server using Javascript. I want to make more information available on my server's website and take it from the server itself without having to use external services. If this information is documented in the Wiki forgive me for my ignorance but I can't seem to find any at the moment. From what I can gather, process for making a call to a Minecraft server seems to be as so:
Install the JSONAPI Plugin to your server (along with the other dependencies as needed)
Look into configuration files and save the username and password in the users.yml file for later use
If you want to use a salt, include a salt in the config.yml file
Look into the Javascript SDK from tools and load it as one of the scripts for the index.html
In my own script.js file, insert this: var j = new jsonapi({ hostname: "serverIP/domainName", port: 20059, username: "usernameFromUsers.yml", password: "passwordFromUsers.yml", salt: "saltFromConfig.yml" });
And then make calls, like so: j.call('getPlayers', console.log);
However, I seem to get errors with my server and nothing is returned from my get requests. Could I get some help with this?
Activity
krisdb2009 commentedon Nov 27, 2015
What are the errors?
ersgonzalo commentedon Nov 27, 2015
I get two errors:
I can see messages on the server if I use port 25565 but not 20059
Kworz commentedon Nov 28, 2015
Better use Websockets :)
but you will have to use CryptoJS / Other SHA256 crypting system
var socket = new WebSocket("ws://****YOURIP****:20061/");